.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2020 by Total Control Software License: wxWindows License .. include:: headings.inc .. _wx.adv.CommandLinkButton: ========================================================================================================================================== |phoenix_title| **wx.adv.CommandLinkButton** ========================================================================================================================================== 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 :ref:`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 :meth:`~wx.adv.CommandLinkButton.SetMainLabel` or :meth:`~wx.adv.CommandLinkButton.GetNote` or also via :meth:`~wx.adv.CommandLinkButton.SetLabel` and :meth:`~wx.adv.CommandLinkButton.GetLabel` methods inherited from :ref:`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). :ref:`wx.adv.CommandLinkButton` generates the same event as :ref:`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. .. versionadded:: 2.9.2 .. seealso:: :ref:`wx.Button`, :ref:`wx.BitmapButton` | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class CommandLinkButton:
| |appearance| Control Appearance =============================== | .. figure:: _static/images/widgets/fullsize/wxmsw/wx.adv.commandlinkbutton.png :alt: wxMSW :figclass: floatleft **wxMSW** .. figure:: _static/images/widgets/fullsize/wxmac/../no_appearance.png :alt: wxMAC :figclass: floatright **wxMAC** .. figure:: _static/images/widgets/fullsize/wxgtk/wx.adv.commandlinkbutton.png :alt: wxGTK :figclass: floatcenter **wxGTK** | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.adv.CommandLinkButton.__init__` Default constructor. :meth:`~wx.adv.CommandLinkButton.Create` Button creation function for two-step creation. :meth:`~wx.adv.CommandLinkButton.GetClassDefaultAttributes` :meth:`~wx.adv.CommandLinkButton.GetLabel` Returns the string label for the button. :meth:`~wx.adv.CommandLinkButton.GetMainLabel` Returns the current main label. :meth:`~wx.adv.CommandLinkButton.GetNote` Returns the currently used note. :meth:`~wx.adv.CommandLinkButton.SetLabel` Sets the string label and note for the button. :meth:`~wx.adv.CommandLinkButton.SetMainLabel` Changes the main label. :meth:`~wx.adv.CommandLinkButton.SetMainLabelAndNote` Sets a new main label and note for the button. :meth:`~wx.adv.CommandLinkButton.SetNote` Changes the note. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~wx.adv.CommandLinkButton.Label` See :meth:`~wx.adv.CommandLinkButton.GetLabel` and :meth:`~wx.adv.CommandLinkButton.SetLabel` :attr:`~wx.adv.CommandLinkButton.MainLabel` See :meth:`~wx.adv.CommandLinkButton.GetMainLabel` and :meth:`~wx.adv.CommandLinkButton.SetMainLabel` :attr:`~wx.adv.CommandLinkButton.Note` See :meth:`~wx.adv.CommandLinkButton.GetNote` and :meth:`~wx.adv.CommandLinkButton.SetNote` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: 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. .. method:: __init__(self, *args, **kw) |overload| Overloaded Implementations: :html:`

` **__init__** `(self)` Default constructor. Use :meth:`Create` to really create the control. :html:`

` **__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. :param `parent`: Parent window. Must not be ``None``. :type `parent`: wx.Window :param `id`: Button identifier. A value of ``wx.ID_ANY`` indicates a default value. :type `id`: wx.WindowID :param `mainLabel`: First line of text on the button, typically the label of an action that will be made when the button is pressed. :type `mainLabel`: string :param `note`: Second line of text describing the action performed when the button is pressed. :type `note`: string :param `pos`: Button position. :type `pos`: wx.Point :param `size`: Button size. If the default size is specified then the button is sized appropriately for the text. :type `size`: wx.Size :param `style`: Window style. See :ref:`wx.Button` class description. :type `style`: long :param `validator`: Window validator. :type `validator`: wx.Validator :param `name`: Window name. :type `name`: string .. seealso:: :meth:`Create` , :ref:`wx.Validator` :html:`

` .. method:: 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 :ref:`wx.adv.CommandLinkButton`. :param `parent`: :type `parent`: wx.Window :param `id`: :type `id`: wx.WindowID :param `mainLabel`: :type `mainLabel`: string :param `note`: :type `note`: string :param `pos`: :type `pos`: wx.Point :param `size`: :type `size`: wx.Size :param `style`: :type `style`: long :param `validator`: :type `validator`: wx.Validator :param `name`: :type `name`: string :rtype: `bool` .. staticmethod:: GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL) :param `variant`: :type `variant`: wx.WindowVariant :rtype: `VisualAttributes` .. method:: GetLabel(self) Returns the string label for the button. :rtype: `string` :returns: A string with the main label and note concatenated together with a newline separating them. .. seealso:: :meth:`SetLabel` .. method:: GetMainLabel(self) Returns the current main label. :rtype: `string` :returns: Main label currently displayed. .. method:: GetNote(self) Returns the currently used note. :rtype: `string` :returns: Note currently displayed. .. method:: SetLabel(self, label) Sets the string label and note for the button. :param `label`: The label and note to set, with the two separated by the first newline or none to set a blank note. :type `label`: string .. method:: SetMainLabel(self, mainLabel) Changes the main label. :param `mainLabel`: New main label to use. :type `mainLabel`: string .. method:: 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 :meth:`SetMainLabel` or :meth:`SetNote` instead of this function. :param `mainLabel`: New main label to use. :type `mainLabel`: string :param `note`: New note to use. :type `note`: string .. method:: SetNote(self, note) Changes the note. :param `note`: New note to use. :type `note`: string .. attribute:: Label See :meth:`~wx.adv.CommandLinkButton.GetLabel` and :meth:`~wx.adv.CommandLinkButton.SetLabel` .. attribute:: MainLabel See :meth:`~wx.adv.CommandLinkButton.GetMainLabel` and :meth:`~wx.adv.CommandLinkButton.SetMainLabel` .. attribute:: Note See :meth:`~wx.adv.CommandLinkButton.GetNote` and :meth:`~wx.adv.CommandLinkButton.SetNote`