Most all widgets are used in this example. A full custom widget
is included. A number of connections are used to make the application
function.
The Painter class has its own paint method to render the painting surface and overlay.
158: def paint(self,s):
159: s.blit(self.surface,(0,0))
160: s.blit(self.overlay,(0,0))
Initializing the Menus, we connect to a number of Dialog.open methods for each of the dialogs.
254: menus = gui.Menus([
255: ('File/New',self.new_d.open,None),
256: ('File/Open',self.open_d.open,None),
257: ('File/Save',self.action_save,None),
258: ('File/Save As',self.save_d.open,None),
259: ('File/Exit',self.quit_d.open,None),
260: ('Help/Help',self.help_d.open,None),
261: ('Help/About',self.about_d.open,None),
262: ])
We utilize a Toolbox. The value of this widget determins how drawing is done in the Painter class.
270: self.mode = mode = gui.Toolbox([
271: ('Draw','draw'),
272: ('Box','box'),
273: ('Circle','circle'),
274: ('Cuzco','cuzco'),
275: ],cols=1,value='draw')