AGW Logo

agw_title Control

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

hierarchy Inheritance Diagram

Inheritance diagram for: Control

Inheritance diagram of Control


method_summary Methods Summary

__init__Default class constructor.
DisableDisables the control.
DrawHandles the drawing of the control.
EnableEnable or disable the window for user input.
GetBestSizeThis functions returns the best acceptable minimal size for the window.
GetIdReturns the identifier of the window.
HasFocusReturns whether the control has the focus or not.
HideHides the control.
IsShownReturns True if the window is shown, False if it has been hidden.
OnMouseEventHandles the wx.EVT_MOUSE_EVENTS events for the control.
SetFocusSets or kills the focus on the control.
ShowShows or hide the control.

API Class API

class Control(wx.EvtHandler)[source]

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



__init__(parent, size=wx.Size(-1, -1), id=wx.ID_ANY)[source]

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()[source]

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(rect)[source]

Handles the drawing of the control.

Parameters:rect (wx.Rect) – the control client rectangle.


Enable(value=True)[source]

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()[source]

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 wx.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()[source]

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()[source]

Returns whether the control has the focus or not.

Returns:True if the control has the focus, False otherwise.


Hide()[source]

Hides the control.

Note

This is functionally equivalent of calling Show with a False input.



IsShown()[source]

Returns True if the window is shown, False if it has been hidden.



OnMouseEvent(x, y, event)[source]

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 wx.MouseEvent event to be processed.


SetFocus(focus=True)[source]

Sets or kills the focus on the control.

Parameters:focus (bool) – whether the control can receive keyboard inputs or not.


Show(show=True)[source]

Shows or hide the control.

Parameters:show (bool) – If True displays the window. Otherwise, it hides it.
Tree

Table Of Contents

Previous topic

ButtonPanelText

Next topic

Separator