Phoenix Logo

phoenix_title wx.lib.agw.buttonpanel.Control

This class represents a base class for all pseudo controls used in ButtonPanel.


class_hierarchy Class Hierarchy

Inheritance diagram for class Control:


super_classes Known Superclasses

wx.EvtHandler


method_summary Methods Summary

__init__ Default class constructor.
Disable Disables the control.
Draw Handles the drawing of the control.
Enable Enable or disable the window for user input.
GetBestSize This functions returns the best acceptable minimal size for the window. For
GetId Returns the identifier of the window.
HasFocus Returns whether the control has the focus or not.
Hide Hides the control.
IsShown Returns True if the window is shown, False if it has been hidden.
OnMouseEvent Handles the wx.EVT_MOUSE_EVENTS events for the control.
SetFocus Sets or kills the focus on the control.
Show Shows or hide the control.

api 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 a False 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. If False, 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 reenabled 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 a False 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.