mkRPG
 All Classes Namespaces Functions
Public Member Functions | Public Attributes
interface.gui.gui_elements.Button Class Reference
Inheritance diagram for interface.gui.gui_elements.Button:
interface.gui.gui_elements.TextField interface.gui.gui_elements.GUIElement

List of all members.

Public Member Functions

def __init__
def build
def update
def handle_event

Public Attributes

 state
 action
 cache
 image
 rect

Detailed Description

Simple button 

Constructor & Destructor Documentation

def interface.gui.gui_elements.Button.__init__ (   self,
  text,
  action,
  style 
)
Style should have the following attributes:
size : int * int (if 0,0 size will fit the text)
background_color : int * int * int * int (R,G,B and alpha)
background_image : pygame.Surface (to use, if this
                        attribute is specified and not empty,
                        size and background_color will be
                        ignored)
text_size : int
text_color : int * int * int * int (R,G,B and alpha values)
text_font : string (name of the font file or None)
text_align : string (should be "centered", "right" or "left")
text_interline : int (pixels between two lines)

mover_background_color : int * int * int * int (color when mouse
                                                is over)
mover_background_image : pygame.Surface (to use, if this
                        attribute is specified and not empty,
                        size and background_color will be
                        ignored)

click_background_color : int * int * int * int (color when
                                                clicked)
click_background_image : pygame.Surface (to use, if this
                        attribute is specified and not empty,
                        size and background_color will be
                        ignored)
    Action should be a function to call on click

    Note : Rendered text won't fit automatically on the given size if
    it's too big, one should put endlines where needed

Member Function Documentation

build all images for this element and cache them 

Reimplemented from interface.gui.gui_elements.TextField.

event should be guiEvent.CLICK, guiEvent.OVER or
    guiEvent.NONE 

Reimplemented from interface.gui.gui_elements.GUIElement.

def interface.gui.gui_elements.Button.update (   self,
  state = None 
)
switch between images depending on state 

Reimplemented from interface.gui.gui_elements.GUIElement.


The documentation for this class was generated from the following file:
 All Classes Namespaces Functions