Skip to content
Related Articles

Related Articles

setToolTip method in PyQt5

Improve Article
Save Article
  • Last Updated : 26 Mar, 2020
Improve Article
Save Article

setToolTip() method is used to setting up a tooltip of a widget in PyqT5 application.

A tooltip is a hint in a desktop application (graphical user interface). Tooltips frequently appear when mouse hover over a widget without clicking it. Sometimes, when mouse arrow is held on the button it shows some information that information is a tooltip message.

Syntax : widget.setToolTip(Message)

Argument : It takes string as argument.

Below is the implementation of this method.

# importing the required libraries
from PyQt5.QtGui import * 
from PyQt5.QtWidgets import * 
import sys
class Window(QMainWindow):
    def __init__(self):
        # set the title
        # set the geometry
        self.setGeometry(0, 0, 300, 300)
        # creating a button widget
        self.widget = QPushButton('Widget', self)
        # setting up the tooltip
        self.widget.setToolTip("This is a button widget !")
        # show all the widgets
# 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
Related Articles

Start Your Coding Journey Now!