Table Of Contents

Previous topic

Tm

Next topic

ToolBar

This Page

phoenix_title ToggleButton

ToggleButton is a button that stays pressed when clicked by the user.

In other words, it is similar to CheckBox in functionality but looks like a Button.

Since wxWidgets version 2.9.0 this control emits an update UI event.

You can see ToggleButton in action in .

events Events Emitted by this Class

Handlers bound for the following event types will receive a CommandEvent parameter.

  • EVT_TOGGLEBUTTON: Handles a wxEVT_COMMAND_TOGGLEBUTTON_CLICKED event.

class_hierarchy Inheritance Diagram

Inheritance diagram for class ToggleButton

Inheritance diagram of ToggleButton


appearance Control Appearance


wxMSW

wxMSW

wxMAC

wxMAC

wxGTK

wxGTK


sub_classes Known Subclasses

BitmapToggleButton


method_summary Methods Summary

__init__ Default constructor.
Create Creates the toggle button for two-step construction.
GetValue Gets the state of the toggle button.
SetValue Sets the toggle button to the given state.

property_summary Properties Summary

Value See GetValue and SetValue

api Class API



class ToggleButton(AnyButton)

ToggleButton is a button that stays pressed when clicked by the user.

Possible constructors:

ToggleButton()

ToggleButton(parent, id=ID_ANY, label='', pos=DefaultPosition,
             size=DefaultSize, style=0, val=DefaultValidator, name=CheckBoxNameStr)

Methods



__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self)

Default constructor.



__init__ (self, parent, id=ID_ANY, label=’‘, pos=DefaultPosition, size=DefaultSize, style=0, val=DefaultValidator, name=CheckBoxNameStr)

Constructor, creating and showing a toggle button.

Parameters:
  • parent (Window) – Parent window. Must not be None.
  • id (int) – Toggle button identifier. The value ID_ANY indicates a default value.
  • label (string) – Text to be displayed next to the toggle button.
  • pos (Point) – Toggle button position. If DefaultPosition is specified then a default position is chosen.
  • size (Size) – Toggle button size. If DefaultSize is specified then a default size is chosen.
  • style (long) – Window style. See ToggleButton.
  • val (Validator) – Window validator.
  • name (string) – Window name.

See also

Create , Validator





Create(self, parent, id=ID_ANY, label='', pos=DefaultPosition, size=DefaultSize, style=0, val=DefaultValidator, name=CheckBoxNameStr)

Creates the toggle button for two-step construction.

See ToggleButton for details.

Parameters:
  • parent (Window) –
  • id (int) –
  • label (string) –
  • pos (Point) –
  • size (Size) –
  • style (long) –
  • val (Validator) –
  • name (string) –
Return type:

bool



GetValue(self)

Gets the state of the toggle button.

Return type:bool
Returns:Returns True if it is pressed, False otherwise.


SetValue(self, state)

Sets the toggle button to the given state.

This does not cause a EVT_TOGGLEBUTTON event to be emitted.

Parameters:state (bool) – If True, the button is pressed.

Properties



Value

See GetValue and SetValue