13.07.2015 Views

The wxPython tutorial

The wxPython tutorial

The wxPython tutorial

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>The</strong> Graphics Device Interfacehttp://www.zetcode.com/wxpython/gdi/Python IDEHome ContentsEdit, Test, and Debug Free 30-day Trialwww.wingware.comFree Floor Plan SoftwareMake Floor Plans in Minutes See Examples.Free Download!<strong>The</strong> GDI<strong>The</strong> GDI (Graphics Device Interface) is an interface forworking with graphics. It is used to interact with graphicdevices such as monitor, printer or a file. <strong>The</strong> GDI allowsprogrammers to display data on a screen or printer withouthaving to be concerned about the details of a particulardevice. <strong>The</strong> GDI insulates the programmer from the hardware.Figure: <strong>The</strong> GDI structureFrom the programmer's point of view, the GDI is a group ofclasses and methods for working with graphics. <strong>The</strong> GDIconsists of 2D Vector Graphics, Fonts and Images.To begin drawing graphics, we must create a device context(DC) object. In <strong>wxPython</strong> the device context is called wx.DC.<strong>The</strong> documentation defines wx.DC as a device context ontowhich which graphics and text can be drawn. It representsnumber of devices in a generic way. Same piece of code canwrite to different kinds of devices. Be it a screen or a printer.<strong>The</strong> wx.DC is not intended to be used directly. Instead aprogrammer should choose one of the derived classes. Eachderived class is intended to be used under specific conditions.Derived wx.DC classes1 de 44 27/04/2008 1:08

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!