AGW Logo

agw_title ButtonInfo

This class holds information about every button that is added to ButtonPanel. It is an auxiliary class that you should use every time you add a button.

hierarchy Inheritance Diagram

Inheritance diagram for: ButtonInfo

Inheritance diagram of ButtonInfo


supclasses Known Superclasses


method_summary Methods Summary

__init__Default class constructor.
AddStatusAdd a programmer-defined status in addition to the 5 default status:
CheckRefreshChecks whether a ButtonPanel repaint is needed or not. This is a convenience function.
DrawDraws the button on ButtonPanel. Actually the drawing is done in BPArt.
EnableEnables/disables this instance of ButtonInfo.
GetBestSizeReturns the best size for the button.
GetBitmapReturns the bitmap associated with this instance of ButtonInfo.
GetIdReturns the ButtonInfo id.
GetKindReturns the button type (standard or toggle).
GetLongHelpReturns the help string shown in the statusbar.
GetRectReturns the ButtonInfo client rectangle.
GetShortHelpReturns the help string shown in a tooltip.
GetStatusReturns the ButtonInfo status.
GetTextReturns the text associated to the button.
GetTextAlignmentReturns the text alignment in the button (bottom or right).
GetToggledReturns whether a wx.ITEM_CHECK button is toggled or not.
HasTextReturns whether the button has text or not.
IsEnabledReturns True if this instance of ButtonInfo is enabled for input,
SetBitmapSets the bitmap associated with this instance of ButtonInfo.
SetIdSets the ButtonInfo identifier.
SetKindSets the button type (standard or toggle).
SetLongHelpSets the help string to be shown in the statusbar.
SetRectSets the ButtonInfo client rectangle.
SetShortHelpSets the help string to be shown in a tooltip.
SetStatusSets the ButtonInfo status.
SetTextSets the button label text.
SetTextAlignmentSets the text alignment in the button (bottom or right).
SetToggledSets a wx.ITEM_CHECK button toggled/not toggled.

API Class API

class ButtonInfo(Control)[source]

This class holds information about every button that is added to ButtonPanel. It is an auxiliary class that you should use every time you add a button.



__init__(parent, id=wx.ID_ANY, bmp=wx.NullBitmap, status="Normal", text="", kind=wx.ITEM_NORMAL, shortHelp="", longHelp="")[source]

Default class constructor.

Parameters:
  • parent – the parent window (ButtonPanel);
  • id (integer) – the button id;
  • bmp (wx.Bitmap) – the associated bitmap;
  • status (string) – button status (“Pressed”, “Hover”, “Normal”, “Toggled”, “Disabled”);
  • text (string) – text to be displayed either below of to the right of the button;
  • kind (integer) – button kind, may be wx.ITEM_NORMAL for standard buttons or wx.ITEM_CHECK for toggle buttons;
  • shortHelp (string) – a short help to be shown in the button tooltip;
  • longHelp (string) – this string is shown in the statusbar (if any) of the parent frame when the mouse pointer is inside the button.


AddStatus(name="Custom", bmp=wx.NullBitmap)[source]

Add a programmer-defined status in addition to the 5 default status:

  • Normal;
  • Disabled;
  • Hover;
  • Pressed;
  • Toggled.
Parameters:
  • name (string) – the new status name;
  • bmp (wx.Bitmap) – the bitmap associated with the new status.


Bitmap

Returns the bitmap associated with this instance of ButtonInfo.

Parameters:status (string) – the ButtonInfo status (“Pressed”, “Hover”, “Normal”, “Toggled”, “Disabled”).
Returns:An instance of wx.Bitmap.


CheckRefresh(status)[source]

Checks whether a ButtonPanel repaint is needed or not. This is a convenience function.

Parameters:status (bool) – the status of a newly added ButtonInfo or a change in the ButtonInfo status.


Draw(dc, rect)[source]

Draws the button on ButtonPanel. Actually the drawing is done in BPArt.

Parameters:
  • dc – an instance of wx.DC;
  • rect (wx.Rect) – the main caption text client rectangle.


Enable(enable=True)[source]

Enables/disables this instance of ButtonInfo.

Parameters:enable (bool) – True to enable the button, False otherwise.


GetBestSize()[source]

Returns the best size for the button.

Returns:An instance of wx.Size.


GetBitmap(status=None)[source]

Returns the bitmap associated with this instance of ButtonInfo.

Parameters:status (string) – the ButtonInfo status (“Pressed”, “Hover”, “Normal”, “Toggled”, “Disabled”).
Returns:An instance of wx.Bitmap.


GetId()[source]

Returns the ButtonInfo id.

Returns:An integer representing the button id.


GetKind()[source]

Returns the button type (standard or toggle).

Returns:An integer representing the button type, one of wx.ITEM_NORMAL, wx.ITEM_CHECK.


GetLongHelp()[source]

Returns the help string shown in the statusbar.

Returns:A string containing the ButtonInfo long help string.


GetRect()[source]

Returns the ButtonInfo client rectangle.

Returns:An instance of wx.Rect.


GetShortHelp()[source]

Returns the help string shown in a tooltip.

Returns:A string containing the ButtonInfo short help string.


GetStatus()[source]

Returns the ButtonInfo status.

Returns:A string containing the ButtonInfo status (one of “Pressed”, “Hover”, “Normal”, “Toggled”, “Disabled”).


GetText()[source]

Returns the text associated to the button.

Returns:A string containing the ButtonInfo text.


GetTextAlignment()[source]

Returns the text alignment in the button (bottom or right).

Returns:An integer representing the ButtonInfo text alignment.


GetToggled()[source]

Returns whether a wx.ITEM_CHECK button is toggled or not.

Returns:True if the button is toggled, False otherwise.


HasText()[source]

Returns whether the button has text or not.

Returns:True if this ButtonInfo instance has a label, False otherwise.


Id

Returns the ButtonInfo id.

Returns:An integer representing the button id.


IsEnabled()[source]

Returns True if this instance of ButtonInfo is enabled for input, False otherwise.



Rect

Returns the ButtonInfo client rectangle.

Returns:An instance of wx.Rect.


SetBitmap(bmp, status='Normal')[source]

Sets the bitmap associated with this instance of ButtonInfo.

Parameters:
  • bmp – a valid wx.Bitmap object;

  • status (string) – the ButtonInfo status (“Pressed”, “Hover”, “Normal”, “Toggled”, “Disabled”).


SetId(id)[source]

Sets the ButtonInfo identifier.

Parameters:id (integer) – the identifier of the window.


SetKind(kind=wx.ITEM_NORMAL)[source]

Sets the button type (standard or toggle).

Parameters:kind (integer) – one of wx.ITEM_NORMAL, wx.ITEM_CHECK.


SetLongHelp(help='')[source]

Sets the help string to be shown in the statusbar.

Parameters:help (string) – the string for the long help.


SetRect(rect)[source]

Sets the ButtonInfo client rectangle.

Parameters:rect – an instance of wx.Rect.



SetShortHelp(help='')[source]

Sets the help string to be shown in a tooltip.

Parameters:help (string) – the string for the short help.


SetStatus(status)[source]

Sets the ButtonInfo status.

Parameters:status (string) – one of “Pressed”, “Hover”, “Normal”, “Toggled”, “Disabled”.


SetText(text='')[source]

Sets the button label text.

Parameters:text (string) – the button label string.


SetTextAlignment(alignment)[source]

Sets the text alignment in the button (bottom or right).

Parameters:alignment (integer) – the text alignment in this ButtonInfo instance.


SetToggled(toggle=True)[source]

Sets a wx.ITEM_CHECK button toggled/not toggled.

Parameters:toggle (bool) – True to toggle the button, False otherwise.


Status

Returns the ButtonInfo status.

Returns:A string containing the ButtonInfo status (one of “Pressed”, “Hover”, “Normal”, “Toggled”, “Disabled”).
Tree

Table Of Contents

Previous topic

BoxSizer

Next topic

ButtonPanel