GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Table of Contents
  • wx.ToggleButton
  • Show Source
  • index
  • modules
  • next
  • previous
  • Home
  • Gallery
  • wx

This view

  • Original page
  • New address

GeezerVison is showing docs.wxpython.org — wx.ToggleButton — wxPython 4.3.2 Docs

phoenix_title wx.ToggleButton¶

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

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

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

You can see wx.ToggleButton in action in Widgets Sample.

events Events Emitted by this Class¶

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

  • EVT_TOGGLEBUTTON: Handles a wxEVT_TOGGLEBUTTON event.

See also

wx.CheckBox, wx.Button, wx.BitmapToggleButton


class_hierarchy Class Hierarchy¶

Inheritance diagram for class ToggleButton:

Inheritance diagram of ToggleButton


appearance Control Appearance¶


wxMSW

wxMSW¶

wxGTK

wxGTK¶

wxMAC

wxMAC¶


sub_classes Known Subclasses¶

wx.BitmapToggleButton


method_summary Methods Summary¶

__init__

Default constructor.

Create

Creates the toggle button for two-step construction.

GetClassDefaultAttributes

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 wx.ToggleButton(AnyButton)¶

Possible constructors:

ToggleButton() -> None

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

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


Methods¶

__init__(self, *args, **kw)¶

overload Overloaded Implementations:



__init__ (self)

Default constructor.

Return type:

None



__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 (wx.Window) – Parent window. Must not be nullptr.

  • id (wx.WindowID) – Toggle button identifier. The value wx.ID_ANY indicates a default value.

  • label (string) – Text to be displayed next to the toggle button.

  • pos (wx.Point) – Toggle button position. If wx.DefaultPosition is specified then a default position is chosen.

  • size (wx.Size) – Toggle button size. If wx.DefaultSize is specified then a default size is chosen.

  • style (long) – Window style. See wx.ToggleButton.

  • val (wx.Validator) – Window validator.

  • name (string) – Window name.

Return type:

None

See also

Create , wx.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 wx.ToggleButton for details.

Parameters:
  • parent (wx.Window)

  • id (wx.WindowID)

  • label (string)

  • pos (wx.Point)

  • size (wx.Size)

  • style (long)

  • val (wx.Validator)

  • name (string)

Return type:

bool



static GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL)¶
Parameters:

variant (WindowVariant)

Return type:

wx.VisualAttributes



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.

Return type:

None


Properties¶

Value¶

See GetValue and SetValue

© Copyright 2012-2026, The wxPython Team. Created using Sphinx 9.1.0 and the python-docs-theme.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.