wx.lib.agw.buttonpanel.Control¶
This class represents a base class for all pseudo controls used in
ButtonPanel
.
Class Hierarchy¶
Known Subclasses¶
wx.lib.agw.buttonpanel.ButtonInfo
, wx.lib.agw.buttonpanel.ButtonPanelText
, wx.lib.agw.buttonpanel.Separator
Known Superclasses¶
Methods Summary¶
Default class constructor. |
|
Disables the control. |
|
Handles the drawing of the control. |
|
Enable or disable the window for user input. |
|
This functions returns the best acceptable minimal size for the window. For |
|
Returns the identifier of the window. |
|
Returns whether the control has the focus or not. |
|
Hides the control. |
|
Returns |
|
Handles the |
|
Sets or kills the focus on the control. |
|
Shows or hide the control. |
Class API¶
- class Control(wx.EvtHandler)¶
This class represents a base class for all pseudo controls used in
ButtonPanel
.
Methods¶
- __init__(self, parent, size=wx.Size(-1, -1), id=wx.ID_ANY)¶
Default class constructor.
- Parameters:
parent (wx.Window) – the control parent object. Must not be
None
;size (tuple or
wx.Size
) – the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform;id (integer) – window identifier. A value of -1 indicates a default value.
- Disable(self)¶
Disables the control.
- Returns:
True
if the window has been disabled,False
if it had been already disabled before the call to this function.
Note
This is functionally equivalent of calling
Enable
with aFalse
flag.
- Draw(self, rect)¶
Handles the drawing of the control.
- Parameters:
rect (wx.Rect) – the control client rectangle.
- Enable(self, enable=True)¶
Enable or disable the window for user input.
- Parameters:
enable (bool) – If
True
, enables the window for input. IfFalse
, disables the window.- Returns:
True
if the window has been enabled or disabled,False
if nothing was done, i.e. if the window had already been in the specified state.
Note
Note that when a parent window is disabled, all of its children are disabled as well and they are re-enabled again when the parent is.
- GetBestSize(self)¶
This functions returns the best acceptable minimal size for the window. For example, for a static control, it will be the minimal size such that the control label is not truncated. For windows containing subwindows (typically
Panel
), the size returned by this function will be the same as the size the window would have had after calling Fit().- Returns:
An instance of
wx.Size
.
- GetId(self)¶
Returns the identifier of the window.
- Returns:
An integer representing the identifier of the window.
Note
Each window has an integer identifier. If the application has not provided one (or the default
wx.ID_ANY
) an unique identifier with a negative value will be generated.
- HasFocus(self)¶
Returns whether the control has the focus or not.
- Returns:
True
if the control has the focus,False
otherwise.
- Hide(self)¶
Hides the control.
Note
This is functionally equivalent of calling
Show
with aFalse
input.
- IsShown(self)¶
Returns
True
if the window is shown,False
if it has been hidden.
- OnMouseEvent(self, x, y, event)¶
Handles the
wx.EVT_MOUSE_EVENTS
events for the control.- Parameters:
x (integer) – the mouse x position;
y (integer) – the mouse y position;
event – the
MouseEvent
event to be processed.
- SetFocus(self, focus=True)¶
Sets or kills the focus on the control.
- Parameters:
focus (bool) – whether the control can receive keyboard inputs or not.
- Show(self, show=True)¶
Shows or hide the control.
- Parameters:
show (bool) – If
True
displays the window. Otherwise, it hides it.