Commit before breaking everything
[matches/honours.git] / research / transmission_spectroscopy / simulator / pgu-0.18 / examples / gui4.py
1 """<title>Custom Widgets</title>
2 Same functionality as gui3, however gui.Button is subclassed.  The
3 subclassed version is a fully featured Quit button.
4 """
5 import pygame
6 from pygame.locals import *
7
8 # the following line is not needed if pgu is installed
9 import sys; sys.path.insert(0, "..")
10
11 from pgu import gui
12
13 app = gui.Desktop()
14 app.connect(gui.QUIT,app.quit,None)
15
16 c = gui.Table(width=200,height=120)
17
18 ##::
19 class Quit(gui.Button):
20     def __init__(self,**params):
21         params['value'] = 'Quit'
22         gui.Button.__init__(self,**params)
23         self.connect(gui.CLICK,app.quit,None)
24 ##
25
26 ##Adding the button to the container.  By using the td method to add it, the button
27 ##is placed in a sub-container, and it will not have to fill the whole cell.
28 ##::
29 c.tr()
30 e = Quit()
31 c.td(e)
32 ##
33
34 app.run(c)

UCC git Repository :: git.ucc.asn.au