 
       wx.lib.buttons.GenButton¶
  wx.lib.buttons.GenButton¶A generic button, and base class for the other generic buttons.
 Known Subclasses¶
 Known Subclasses¶wx.lib.analogclock.lib_setup.fontselect.FontSelect, wx.lib.buttons.GenBitmapButton, wx.lib.buttons.GenToggleButton, wx.lib.buttons.ThemedGenButton
 Methods Summary¶
 Methods Summary¶| __init__ | Default class constructor. | 
| AcceptsFocus | Can this window be given focus by mouse click? | 
| DoGetBestSize | Overridden base class virtual. Determines the best size of the | 
| DrawBezel | |
| DrawFocusIndicator | |
| DrawLabel | |
| Enable | Enables/disables the button. | 
| GetBackgroundBrush | Returns the current wx.Brushto be used to draw the button background. | 
| GetBezelWidth | Returns the width of the 3D effect, in pixels. | 
| GetDefaultAttributes | Overridden base class virtual. By default we should use | 
| GetUseFocusIndicator | Returns the focus indicator flag, specifying if a focus indicator | 
| InitColours | Calculate a new set of highlight and shadow colours based on | 
| InitOtherEvents | Override this method in a subclass to initialize any other events that | 
| Notify | Actually sends a wx.EVT_BUTTONevent to the listener (if any). | 
| OnGainFocus | Handles the wx.EVT_SET_FOCUSevent forGenButton. | 
| OnKeyDown | Handles the wx.EVT_KEY_DOWNevent forGenButton. | 
| OnKeyUp | Handles the wx.EVT_KEY_UPevent forGenButton. | 
| OnLeftDown | Handles the wx.EVT_LEFT_DOWNevent forGenButton. | 
| OnLeftUp | Handles the wx.EVT_LEFT_UPevent forGenButton. | 
| OnLoseFocus | Handles the wx.EVT_KILL_FOCUSevent forGenButton. | 
| OnMotion | Handles the wx.EVT_MOTIONevent forGenButton. | 
| OnPaint | Handles the wx.EVT_PAINTevent forGenButton. | 
| OnSize | Handles the wx.EVT_SIZEevent forGenButton. | 
| SetBackgroundColour | Sets the GenButtonbackground colour. | 
| SetBezelWidth | Sets the width of the 3D effect. | 
| SetDefault | This sets the GenButtonto be the default item for | 
| SetForegroundColour | Sets the wx.GenButtonforeground colour. | 
| SetInitialSize | Given the current font and bezel width settings, calculate | 
| SetUseFocusIndicator | Specifies if a focus indicator (dotted line) should be used. | 
| ShouldInheritColours | Overridden base class virtual. Buttons usually don’t inherit | 
 Class API¶
 Class API¶A generic button, and base class for the other generic buttons.
Default class constructor.
| Parameters: | 
 | 
|---|
See also
wx.Button for a list of valid window styles.
Can this window be given focus by mouse click?
Note
Overridden from wx.Control.
Overridden base class virtual. Determines the best size of the button based on the label and bezel size.
| Returns: | An instance of wx.Size. | 
|---|
Note
Overridden from wx.Control.
Enables/disables the button.
| Parameters: | enable (bool) – Trueto enable the button,Falseto disable it. | 
|---|
Note
Overridden from wx.Control.
Returns the current wx.Brush to be used to draw the button background.
| Parameters: | dc (wx.DC) – the device context used to draw the button background. | 
|---|
Returns the width of the 3D effect, in pixels.
| Return type: | integer | 
|---|
Overridden base class virtual. By default we should use
the same font/colour attributes as the native wx.Button.
| Returns: | an instance of wx.VisualAttributes. | 
|---|
Note
Overridden from wx.Control.
Returns the focus indicator flag, specifying if a focus indicator (dotted line) is being used.
| Return type: | bool | 
|---|
Calculate a new set of highlight and shadow colours based on the background colour. Works okay if the colour is dark...
Override this method in a subclass to initialize any other events that
need to be bound.  Added so __init__ doesn’t need to be
overridden, which is complicated with multiple inheritance.
Actually sends a wx.EVT_BUTTON event to the listener (if any).
Handles the wx.EVT_SET_FOCUS event for GenButton.
| Parameters: | event – a wx.FocusEventevent to be processed. | 
|---|
Handles the wx.EVT_KEY_DOWN event for GenButton.
| Parameters: | event – a wx.KeyEventevent to be processed. | 
|---|
Handles the wx.EVT_KEY_UP event for GenButton.
| Parameters: | event – a wx.KeyEventevent to be processed. | 
|---|
Handles the wx.EVT_LEFT_DOWN event for GenButton.
| Parameters: | event – a wx.MouseEventevent to be processed. | 
|---|
Handles the wx.EVT_LEFT_UP event for GenButton.
| Parameters: | event – a wx.MouseEventevent to be processed. | 
|---|
Handles the wx.EVT_KILL_FOCUS event for GenButton.
| Parameters: | event – a wx.FocusEventevent to be processed. | 
|---|
Handles the wx.EVT_MOTION event for GenButton.
| Parameters: | event – a wx.MouseEventevent to be processed. | 
|---|
Handles the wx.EVT_PAINT event for GenButton.
| Parameters: | event – a wx.PaintEventevent to be processed. | 
|---|
Handles the wx.EVT_SIZE event for GenButton.
| Parameters: | event – a wx.SizeEventevent to be processed. | 
|---|
Sets the GenButton background colour.
| Parameters: | colour – a valid wx.Colourobject. | 
|---|
Note
Overridden from wx.Control.
Sets the width of the 3D effect.
| Parameters: | width (integer) – the 3D border width, in pixels. | 
|---|
This sets the GenButton to be the default item for
the panel or dialog box.
Note
Under Windows, only dialog box buttons respond to this function.
As normal under Windows and Motif, pressing return causes the
default button to be depressed when the return key is pressed. See
also wx.Window.SetFocus which sets the keyboard focus for
windows and text panel items, and
wx.TopLevelWindow.SetDefaultItem.
Note
Note that under Motif, calling this function immediately after
creation of a button and before the creation of other buttons will
cause misalignment of the row of buttons, since default buttons are
larger. To get around this, call wx.SetDefault after you
have created a row of buttons: wxPython will then set the size of
all buttons currently on the panel to the same size.
Sets the wx.GenButton foreground colour.
| Parameters: | colour – a valid wx.Colourobject. | 
|---|
Note
Overridden from wx.Control.
Given the current font and bezel width settings, calculate and set a good size.
| Parameters: | size – an instance of wx.SizeorNone,
in which case the wxPythonwx.DefaultSizeis used instead. | 
|---|
Specifies if a focus indicator (dotted line) should be used.
| Parameters: | flag (bool) – Trueto draw a focus ring,Falseotherwise. | 
|---|
Overridden base class virtual. Buttons usually don’t inherit the parent’s colours.
Note
Overridden from wx.Control.