setToolTip method in PyQt5
Last Updated :
26 Mar, 2020
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.
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
import sys
class Window(QMainWindow):
def __init__( self ):
super ().__init__()
self .setWindowTitle( "Tooltip" )
self .setGeometry( 0 , 0 , 300 , 300 )
self .widget = QPushButton( 'Widget' , self )
self .widget.setToolTip( "This is a button widget !" )
self .show()
App = QApplication(sys.argv)
window = Window()
sys.exit(App. exec ())
|
Output :
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...