PyQt5 QCommandLinkButton - Setting Description Text

PyQt5 QCommandLinkButton - Setting Description Text

In PyQt5, the QCommandLinkButton is a push button that can contain both a main text and a description text. The description text appears below the main text and is typically used to provide more information about the action.

Here's how to create a QCommandLinkButton and set its main text and description text:

from PyQt5.QtWidgets import QApplication, QWidget, QVBoxLayout, QCommandLinkButton class App(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): layout = QVBoxLayout(self) # Create a QCommandLinkButton button = QCommandLinkButton("Main Text", "This is the description text.", self) layout.addWidget(button) self.setLayout(layout) self.setWindowTitle('QCommandLinkButton Example') self.show() if __name__ == '__main__': app = QApplication([]) ex = App() app.exec_() 

In this code:

  • "Main Text" is the main text of the button.
  • "This is the description text." is the description text.

The description text provides supplementary information about the button's action. It is rendered in a smaller, lighter font below the main text. If you're familiar with Windows, you'll recognize this style of button from various system dialogs.


More Tags

query-string mysql credentials marshalling ngx-datatable onesignal mouseevent download-manager render service-accounts

More Programming Guides

Other Guides

More Programming Examples