This chapter covers
■ Loading images and creating image objects
■ Creating device contexts
■ Drawing to device contexts
■ Drawing text to the context
■ Managing drawing pens, drawing brushes, and device coordinates
The most fundamental action that any UI toolkit performs is the simple act of drawing on the screen. At its most basic level, every widget defined in wxPython consists of a series of draw commands sent to the screen. Whether those draw commands are in the wxPython codebase depends on whether the widget is native to the local operating system or completely defined by wxPython. In this chapter, we'll show you how to control wxPython at the level of basic drawing commands. We'll also show you how to manage and display other graphical elements like images and fonts.
The primary abstraction used by wxPython in drawing is the device context. The device context uses a standard API to manage drawing to devices such as the screen or a printer. The device context classes are where the most basic drawing functionality is located, such as drawing lines, curves, or text.
Was this article helpful?