Package ocempgui :: Package widgets :: Module ToggleButton :: Class ToggleButton
[show private | hide private]
[frames | no frames]

Type ToggleButton

 object --+                    
          |                    
INotifyable --+                
              |                
     BaseObject --+            
                  |            
     object --+   |            
              |   |            
         Sprite --+            
                  |            
         BaseWidget --+        
                      |        
                    Bin --+    
                          |    
                 ButtonBase --+
                              |
                             ToggleButton

Known Subclasses:
CheckButton, RadioButton

ToggleButton (text) -> ToggleButton

A button widget class, which can retain its state.

The default ToggleButton widget looks and behaves usually the same as the Button widget except that it will retain its state upon clicks.

The state of the ToggleButton can be set with the 'active' attribute or set_active() method. If the ToggleButton is active, the 'state' attribute will be set to STATE_ACTIVE by default and will be reset, if the ToggleButton is not active anymore.

toggle.active = True toggle.set_active (False)

The ToggleButton supports different border types by setting its 'border' attribute to a valid value of the BORDER_TYPES constants.

toggle.border = BORDER_SUNKEN toggle.set_border (BORDER_SUNKEN)

Default action (invoked by activate()): The Button emulates a SIG_TOGGLED event and runs the connected callbacks.

Mnemonic action (invoked by activate_mnemonic()): See the Button class.

Signals: SIG_TOGGLED - Invoked, when the ToggleButton is toggled.

Attributes: active - The current state of the ToggleButton as boolean. border - The border style to set for the ToggleButton. text - The text to display on the ToggleButton.
Method Summary
  __init__(self, text)
  activate(self)
T.activate () -> None
  draw(self)
R.draw () -> None
  draw_bg(self)
T.draw () -> Surface
  get_text(self)
T.get_text () -> string
  notify(self, event)
T.notify (event) -> None
  set_active(self, active)
T.set_active (...) -> None
  set_border(self, border)
T.set_border (...) -> None
  set_child(self, child)
B.set_child (...) -> None
  set_state(self, state)
T.set_state (...) -> None
  set_text(self, text)
T.set_text (...) -> None
    Inherited from ButtonBase
  activate_mnemonic(self, mnemonic)
B.activate_mnemonic (...) -> bool
    Inherited from Bin
  destroy(self)
B.destroy () -> None
  set_depth(self, depth)
B.set_depth (...) -> None
  set_event_manager(self, manager)
B.set_event_manager (...) -> None
  set_indexable(self, indexable)
B.set_indexable (...) -> None
  set_padding(self, padding)
B.set_padding (...) -> None
  set_sensitive(self, sensitive)
B.set_sensitive (...) -> None
  update(self, **kwargs)
B.update (...) -> None
    Inherited from BaseWidget
  check_sizes(self, width, height)
W.check_sizes (...) -> int, int
  create_style(self)
W.create_style () -> WidgetStyle
  debug_update(self)
For debugging usage only
  get_style(self)
W.get_style () -> WidgetStyle
  initclass(cls)
B.initclass () -> None (Class method)
  lock(self)
W.lock () -> None
  rect_to_client(self, rect)
W.rect_to_client (...) -> pygame.Rect
  set_dirty(self, dirty, update)
W.set_dirty (...) -> None
  set_entered(self, entered)
W.set_entered (...) -> None
  set_event_area(self, area)
W.set_event_area (...) -> None
  set_focus(self, focus)
W.set_focus (...) -> bool
  set_index(self, index)
W.set_index (...) -> None
  set_maximum_size(self, width, height)
W.set_maximum_size (...) -> None
  set_minimum_size(self, width, height)
W.set_minimum_size (...) -> None
  set_opacity(self, opacity)
W.set_opacity (...) -> None
  set_position(self, x, y)
W.set_position (...) -> None
  set_size(self, width, height)
W.set_size (...) -> None
  set_style(self, style)
W.set_style (...) -> None
  set_tooltip(self, tooltip)
W.set_tooltip (...) -> None
  unlock(self)
W.unlock () -> None
    Inherited from BaseObject
  connect_signal(self, signal, callback, *data)
B.connect_signal (...) -> EventCallback
  disconnect_signal(self, event)
B.disconnect_signal (...) -> None
  emit(self, signal, data)
B.emit (...) -> bool
  run_signal_handlers(self, signal, *data)
B.run_signal_handlers (...) -> None
    Inherited from Sprite
  __repr__(self)
  add(self, *groups)
add(group or list of of groups, ...) add a sprite to container
  add_internal(self, group)
  alive(self)
alive() -> bool check to see if the sprite is in any groups
  groups(self)
groups() -> list of groups list used sprite containers
  kill(self)
kill() remove this sprite from all groups
  remove(self, *groups)
remove(group or list of groups, ...) remove a sprite from container
  remove_internal(self, group)
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __hash__(x)
x.__hash__() <==> hash(x)
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value
  __str__(x)
x.__str__() <==> str(x)

Property Summary
  active: The state of the ToggleButton.
  border: The border style to set for the ToggleButton.
  text: The text of the ToggleButton.
    Inherited from Bin
  child: The widget hold by the Bin.
  padding: Additional padding between child and borders.
    Inherited from BaseWidget
  bottom
  bottomleft
  bottomright
  center
  centerx
  centery
  controls: Widgets associated with the widget.
  depth: The z-axis layer depth of the widget.
  dirty: Indicates, whether the widget need to be redrawn.
  entered: Indicates, whether the widget is entered.
  eventarea: The area, which gets the events.
  focus: The focus of the widget.
  h
  height
  image: The visible surface of the widget.
  index: The tab index position of the widget.
  indexable: The IIndexable, the widget is attached to.
  left
  locked: Indicates, whether the widget is locked.
  maxsize: The maximum size to occupy by the widget.
  midbottom
  midleft
  midright
  midtop
  minsize: The guaranteed size of the widget.
  opacity: The opacity of the widget.
  position: The position of the topleft corner.
  rect: The area occupied by the widget.
  right
  sensitive: The sensitivity of the widget.
  size
  state: The current state of the widget.
  style: The style of the widget.
  tooltip: The tool tip text to display for the widget.
  top
  topleft
  topright
  w
  width
  x
  y
    Inherited from BaseObject
  manager: The event manager to use by the object.

Instance Method Details

activate(self)

T.activate () -> None

Activates the ToggleButton default action.

Activates the Button default action. This usually means toggling the button, emulated by inverting the 'active' attribute and running the attached callbacks for the SIG_TOGGLED signal.
Overrides:
ocempgui.widgets.ButtonBase.ButtonBase.activate

draw(self)

R.draw () -> None

Draws the ToggleButton surface and places its Label on it.
Overrides:
ocempgui.widgets.BaseWidget.BaseWidget.draw

draw_bg(self)

T.draw () -> Surface

Draws the ToggleButton background surface and returns it.

Creates the visible surface of the ToggleButton and returns it to the caller.
Overrides:
ocempgui.widgets.BaseWidget.BaseWidget.draw_bg

get_text(self)

T.get_text () -> string

Returns the set text of the ToggleButton.

Returns the text set on the Label of the ToggleButton.

notify(self, event)

T.notify (event) -> None

Notifies the ToggleButton about an event.
Overrides:
ocempgui.widgets.ButtonBase.ButtonBase.notify

set_active(self, active)

T.set_active (...) -> None

Sets the state of the ToggleButton.

set_border(self, border)

T.set_border (...) -> None

Sets the border type to be used by the ToggleButton.

Raises a ValueError, if the passed argument is not a value from BORDER_TYPES

set_child(self, child=None)

B.set_child (...) -> None

Sets the Label to display on the Button.

Creates a parent-child relationship from the Button to a Label and causes the Label to set its mnemonic widget to the Button.

Raises a TypeError, if the passed argument does not inherit from the Label class.
Overrides:
ocempgui.widgets.Bin.Bin.set_child

set_state(self, state)

T.set_state (...) -> None

Sets the state of the ToggleButton.

Sets the state of the ToggleButton and causes its child to set its state to the same value.
Overrides:
ocempgui.widgets.BaseWidget.BaseWidget.set_state

set_text(self, text=None)

T.set_text (...) -> None

Sets the text to display on the ToggleButton.

Sets the text to display on the ToggleButton by referring to the 'text' attribute of its child Label.

Property Details

active

The state of the ToggleButton.
Get Method:
unknown-696365436(...)
Set Method:
unknown-696365492(...)

border

The border style to set for the ToggleButton.
Get Method:
unknown-696365660(...)
Set Method:
unknown-696365716(...)

text

The text of the ToggleButton.
Get Method:
unknown-696365548(...)
Set Method:
unknown-696365604(...)

Generated by Epydoc 2.1 on Thu Jan 10 10:18:44 2008 http://epydoc.sf.net