Widget
Base class for all PGU graphical objects.
Example - Creating your own Widget:
class Draw(gui.Widget):
def paint(self,s):
# Paint the pygame.Surface
return
def update(self,s):
# Update the pygame.Surface and return the update rects
return [pygame.Rect(0,0,self.rect.w,self.rect.h)]
def event(self,e):
# Handle the pygame.Event
return
def resize(self,width=None,height=None):
# Return the width and height of this widget
return 256,256
Widget.__init__
Create a new Widget instance given the style parameters.
Keyword arguments:
decorate -- whether to call theme.decorate(self) to allow the
theme a chance to decorate the widget. (default is true)
style -- a dict of style parameters.
x, y -- position parameters
width, height -- size parameters
align, valign -- alignment parameters, passed along to style
font -- the font to use with this widget
color -- the color property, if applicable
background -- the widget used to paint the background
cls -- class name as used by Theme
name -- name of widget as used by Form. If set, will call
form.add(self,name) to add the widget to the most recently
created Form.
focusable -- True if this widget can receive focus via Tab, etc.
(default is True)
disabled -- True of this widget is disabled (defaults is False)
value -- initial value