Objects of this class are similar in appearance to the normal Buttons but are similar to the links in a web page in functionality.
Pressing such button usually results in switching to another window of the program and so they can be used as a replacement for the “Next” button in a multi-page dialog (such as wx.adv.Wizard), for example.
Their advantage compared to the ordinary Buttons is that they emphasize the action of switching the window and also that they allow to give more detailed explanation to the user because, in addition to the short button label, they also show a longer description string.
The short, title-like, part of the label is called the main label and the longer description is the note. Both of them can be set and queried independently using CommandLinkButton-specific methods such as SetMainLabel
or GetNote
or also via SetLabel
and GetLabel
methods inherited from wx.Button. When using the latter, the main label and the note are concatenated into a single string using a new line character between them (notice that the note part can have more new lines in it).
wx.adv.CommandLinkButton generates the same event as wx.Button but doesn’t support any of Button-specific styles nor adds any new styles of its own.
Currently this class uses native implementation under Windows Vista and later versions and a generic implementation for the other platforms and earlier Windows versions.
New in version 2.9.2.
See also
Default constructor. |
|
Button creation function for two-step creation. |
|
Returns the string label for the button. |
|
Returns the current main label. |
|
Returns the currently used note. |
|
Sets the string label and note for the button. |
|
Changes the main label. |
|
Sets a new main label and note for the button. |
|
Changes the note. |
See |
|
wx.adv.
CommandLinkButton
(Button)¶Possible constructors:
CommandLinkButton()
CommandLinkButton(parent, id=ID_ANY, mainLabel="", note="",
pos=DefaultPosition, size=DefaultSize, style=0,
validator=DefaultValidator, name=ButtonNameStr)
Objects of this class are similar in appearance to the normal Buttons but are similar to the links in a web page in functionality.
__init__
(self, *args, **kw)¶__init__ (self)
Default constructor.
Use Create
to really create the control.
__init__ (self, parent, id=ID_ANY, mainLabel=””, note=””, pos=DefaultPosition, size=DefaultSize, style=0, validator=DefaultValidator, name=ButtonNameStr)
Constructor really creating a command Link button.
The button will be decorated with stock icons under GTK+ 2.
parent (wx.Window) – Parent window. Must not be None
.
id (wx.WindowID) – Button identifier. A value of wx.ID_ANY
indicates a default value.
mainLabel (string) – First line of text on the button, typically the label of an action that will be made when the button is pressed.
note (string) – Second line of text describing the action performed when the button is pressed.
pos (wx.Point) – Button position.
size (wx.Size) – Button size. If the default size is specified then the button is sized appropriately for the text.
style (long) – Window style. See wx.Button class description.
validator (wx.Validator) – Window validator.
name (string) – Window name.
Create
(self, parent, id=ID_ANY, mainLabel="", note="", pos=DefaultPosition, size=DefaultSize, style=0, validator=DefaultValidator, name=ButtonNameStr)¶Button creation function for two-step creation.
For more details, see wx.adv.CommandLinkButton.
parent (wx.Window) –
id (wx.WindowID) –
mainLabel (string) –
note (string) –
pos (wx.Point) –
size (wx.Size) –
style (long) –
validator (wx.Validator) –
name (string) –
bool
GetClassDefaultAttributes
(variant=WINDOW_VARIANT_NORMAL)¶variant (WindowVariant) –
VisualAttributes
GetLabel
(self)¶Returns the string label for the button.
string
A string with the main label and note concatenated together with a newline separating them.
See also
GetMainLabel
(self)¶Returns the current main label.
string
Main label currently displayed.
GetNote
(self)¶Returns the currently used note.
string
Note currently displayed.
SetLabel
(self, label)¶Sets the string label and note for the button.
label (string) – The label and note to set, with the two separated by the first newline or none to set a blank note.
SetMainLabel
(self, mainLabel)¶Changes the main label.
mainLabel (string) – New main label to use.
SetMainLabelAndNote
(self, mainLabel, note)¶Sets a new main label and note for the button.
Neither of the arguments can be empty, if you need to change just the label or just the note, use SetMainLabel
or SetNote
instead of this function.
mainLabel (string) – New main label to use.
note (string) – New note to use.
SetNote
(self, note)¶Changes the note.
note (string) – New note to use.
MainLabel
¶See GetMainLabel
and SetMainLabel