Package pajammin :: Package display :: Package ui :: Module button :: Class Button
[show private | hide private]
[frames | no frames]

Type Button

  object --+        
           |        
ScreenWidget --+    
               |    
  AbstractButton --+
                   |
                  Button


A button widget. The button can contain text, an image, or both.
Method Summary
  __init__(self, x, y, callback, text, image, callback_data, size, anchor, style, margin)
  click(self)
  draw(self, screen, duration)
Draw this widget to the screen.
  _mousepress(self, event)
  _mouserelease(self, event)
    Inherited from AbstractButton
  draw_down(self, screen)
  draw_hl(self, screen)
  draw_up(self, screen)
  move(self, x, y, anchor)
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
Return hash(x)...
  __new__(T, S, ...)
Return a new object with type S, a subtype of T...
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __repr__(x)
Return repr(x)...
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
Return str(x)...

Instance Variable Summary
  highlighted: Is the button currently highlighted?
    Inherited from AbstractButton
  down: is it pressed?
  layer: An integer indicating the order in which the widget should be drawn to the screen, relative to other widgets.
    Inherited from ScreenWidget
bool hidden: If true, then the screen widget will not be drawn.

Class Variable Summary
dict BG_IMAGE = {'dark': 'ui/button2.gif', 'light': 'ui/butto...
dict TEXT_COLOR = {'dark': (255, 255, 255), 'light': (0, 0, 0...
    Inherited from AbstractButton
dict STYLES = {'dark': ('ui/button2.gif', (255, 255, 255)), '...

Method Details

__init__(self, x=0, y=0, callback=<function _noop at 0x1107430>, text=None, image=None, callback_data=(), size=None, anchor='topleft', style='standard', margin=(10, 6))
(Constructor)

Overrides:
pajammin.display.ui.button.AbstractButton.__init__

click(self)

draw(self, screen, duration)

Draw this widget to the screen.
Parameters:
screen - The screen surface.
duration - The amount of time that has elapsed since the last call to draw, in msec.
Returns:
A pygame Rect indicating what area of the screen has been modified by this draw operation.
Overrides:
pajammin.display.ui.button.AbstractButton.draw (inherited documentation)

_mousepress(self, event)

_mouserelease(self, event)


Instance Variable Details

highlighted

Is the button currently highlighted?

Class Variable Details

BG_IMAGE

Type:
dict
Value:
{'dark': 'ui/button2.gif', 'light': 'ui/button1.gif'}                  

TEXT_COLOR

Type:
dict
Value:
{'dark': (255, 255, 255), 'light': (0, 0, 0)}