QToolTip setting message

import sys
from PyQt5.QtWidgets import (QWidget, QToolTip,
    QPushButton, QApplication)
from PyQt5.QtGui import QFont    


class Example(QWidget):
    
    def __init__(self):
        super().__init__()
        self.initUI()
        
        
        
        
    def initUI(self):
        #Window设置
        self.setGeometry(300, 300, 300, 200)
        self.setWindowTitle('Tooltip提示信息')    
        self.setToolTip('This is a <b>Window</b>')
        self.setFont (QFont ( ' Consolas ' , 10)) # Set Font entire Window 
        
        # the Button disposed          
        BTN = the QPushButton ( ' the Button ' , Self)        
        btn.move ( 50, 50 ) 
        btn.resize ( 50,30 )
         # BTN .setFont (QFont ( 'simsun', 12)) # Button provided only font 
        btn.setToolTip ( ' This iS a <B> Button </ B> ' ) 
        
        self.show () 
       
        
IF  the __name__ == ' __main__ ' : 
    
    App =  the QApplication (the sys.argv)
    EX = Example()
    sys.exit(app.exec_())

 

Guess you like

Origin www.cnblogs.com/conpi/p/11742298.html