Package wx :: Class CheckBox
[frames | no frames]

Type CheckBox

object --+                
         |                
    Object --+            
             |            
    EvtHandler --+        
                 |        
            Window --+    
                     |    
               Control --+
                         |
                        CheckBox


A checkbox is a labelled box which by default is either on (the checkmark is visible) or off (no checkmark). Optionally (When the wx.CHK_3STATE style flag is set) it can have a third state, called the mixed or undetermined state. Often this is used as a "Does Not Apply" state.

Window Styles

wx.CHK_2STATE Create a 2-state checkbox. This is the default.
wx.CHK_3STATE Create a 3-state checkbox.
wx.CHK_ALLOW_3RD_STATE_FOR_USER By default a user can't set a 3-state checkbox to the third state. It can only be done from code. Using this flags allows the user to set the checkbox to the third state by clicking. wx.ALIGN_RIGHT Makes the text appear on the left of the checkbox.

Events

EVT_CHECKBOX Sent when checkbox is clicked.

Method Summary
CheckBox __init__(self, parent, id, label, pos, size, style, validator, name)
Creates and shows a CheckBox control
bool Create(self, parent, id, label, pos, size, style, validator, name)
Actually create the GUI CheckBox for 2-phase creation.
int Get3StateValue(self)
Returns wx.CHK_UNCHECKED when the CheckBox is unchecked, wx.CHK_CHECKED when it is checked and wx.CHK_UNDETERMINED when it's in the undetermined state.
VisualAttributes GetClassDefaultAttributes(variant)
Get the default attributes for this class. (Static method)
bool GetValue(self)
Gets the state of a 2-state CheckBox.
bool Is3rdStateAllowedForUser(self)
Returns whether or not the user can set the CheckBox to the third state.
bool Is3State(self)
Returns whether or not the CheckBox is a 3-state CheckBox.
bool IsChecked(self)
Similar to GetValue, but raises an exception if it is not a 2-state CheckBox.
  Set3StateValue(self, state)
Sets the CheckBox to the given state.
  SetValue(self, state)
Set the state of a 2-state CheckBox.

Property Summary
  thisown: The membership flag
  ThreeStateValue: See Get3StateValue and Set3StateValue
  Value: See GetValue and SetValue

Instance Method Details

__init__(self, parent, id=-1, label=EmptyString, pos=DefaultPosition, size=DefaultSize, style=0, validator=DefaultValidator, name=CheckBoxNameStr)
(Constructor)

Creates and shows a CheckBox control

Parameters:
parent
           (type=Window)

id
           (type=int)

label
           (type=String)

pos
           (type=Point)

size
           (type=Size)

style
           (type=long)

validator
           (type=Validator)

name
           (type=String)

Returns:
CheckBox
Overrides:
wx.Control.__init__

Create(self, parent, id=-1, label=EmptyString, pos=DefaultPosition, size=DefaultSize, style=0, validator=DefaultValidator, name=CheckBoxNameStr)

Actually create the GUI CheckBox for 2-phase creation.

Parameters:
parent
           (type=Window)

id
           (type=int)

label
           (type=String)

pos
           (type=Point)

size
           (type=Size)

style
           (type=long)

validator
           (type=Validator)

name
           (type=String)

Returns:
bool
Overrides:
wx.Control.Create

Get3StateValue(self)

Returns wx.CHK_UNCHECKED when the CheckBox is unchecked, wx.CHK_CHECKED when it is checked and wx.CHK_UNDETERMINED when it's in the undetermined state. Raises an exceptiion when the function is used with a 2-state CheckBox.

Returns:
int

GetValue(self)

Gets the state of a 2-state CheckBox. Returns True if it is checked, False otherwise.

Returns:
bool

Is3rdStateAllowedForUser(self)

Returns whether or not the user can set the CheckBox to the third state.

Returns:
bool

Is3State(self)

Returns whether or not the CheckBox is a 3-state CheckBox.

Returns:
bool

IsChecked(self)

Similar to GetValue, but raises an exception if it is not a 2-state CheckBox.

Returns:
bool

Set3StateValue(self, state)

Sets the CheckBox to the given state. The state parameter can be one of the following: wx.CHK_UNCHECKED (Check is off), wx.CHK_CHECKED (the Check is on) or wx.CHK_UNDETERMINED (Check is mixed). Raises an exception when the CheckBox is a 2-state checkbox and setting the state to wx.CHK_UNDETERMINED.

Parameters:
state
           (type=int)

SetValue(self, state)

Set the state of a 2-state CheckBox. Pass True for checked, False for unchecked.

Parameters:
state
           (type=bool)


Static Method Details

GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL)

Get the default attributes for this class. This is useful if you want to use the same font or colour in your own control as in a standard control -- which is a much better idea than hard coding specific colours or fonts which might look completely out of place on the user's system, especially if it uses themes.

The variant parameter is only relevant under Mac currently and is ignore under other platforms. Under Mac, it will change the size of the returned font. See wx.Window.SetWindowVariant for more about this.

Parameters:
variant
           (type=int)

Returns:
VisualAttributes

Property Details

thisown

The membership flag

ThreeStateValue

See Get3StateValue and Set3StateValue

Get Method:
Get3StateValue(self)
Set Method:
Set3StateValue(self, state)

Value

See GetValue and SetValue

Get Method:
GetValue(self)
Set Method:
SetValue(self, state)

Generated by Epydoc 2.1.20050511.rpd on Mon Feb 16 12:53:23 2009 http://epydoc.sf.net