Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App

Related Articles

PyQt5 – QCommandLinkButton Class

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

QCommandLinkButton is a control widget that was introduced by Windows Vista. Its intended use is similar to that of a radio button in that it is used to choose between a set of mutually exclusive options. The appearance of it is generally similar to that of a flat push button, but it allows for a descriptive text in addition to the normal button text. By default it will also carry an arrow icon, indicating that pressing the control will open another window or page or do something. Below is how the command link button looks like

Example :
We will create a window having a label and the command link button and when the command link button pressed the counter will increment in the label

Below is the implementation

# importing libraries
from PyQt5.QtWidgets import * 
from PyQt5 import QtCore, QtGui
from PyQt5.QtGui import * 
from PyQt5.QtCore import * 
import sys
class Window(QMainWindow):
    def __init__(self):
        # setting title
        self.setWindowTitle("Python ")
        # setting geometry
        self.setGeometry(100, 100, 500, 400)
        # calling method
        # showing all the widgets
    # method for components
    def UiComponents(self):
        # counter value
        self.n = 0
        # creating label
        label = QLabel("Counter", self)
        # setting label geometry
        label.setGeometry(100, 100, 100, 40)
        # creating a command link button
        cl_button = QCommandLinkButton("Next", self)
        # setting geometry
        cl_button.setGeometry(200, 100, 200, 40)
        # adding action to the button
        cl_button.clicked.connect(lambda: increment(self.n))
        # method for incrementing the counter
        def increment(n):
            # increment
            self.n = n + 1
            # setting text to the label
# create pyqt5 app
App = QApplication(sys.argv)
# create the instance of our Window
window = Window()
# start the app

Output :

My Personal Notes arrow_drop_up
Last Updated : 26 Jun, 2020
Like Article
Save Article
Similar Reads
Related Tutorials