zoukankan      html  css  js  c++  java
  • PyQt5--ShowTips

     1 # -*- coding:utf-8 -*-
     2 '''
     3 Created on Sep 13, 2018
     4 
     5 @author: SaShuangYiBing
     6 '''
     7 import sys
     8 from PyQt5.QtWidgets import QApplication,QWidget,QToolTip,QPushButton
     9 from PyQt5.QtGui import QFont
    10 
    11 class New_test(QWidget):
    12     def __init__(self):
    13         super().__init__()
    14         self.initUI()
    15         
    16     def initUI(self):
    17         QToolTip.setFont(QFont('SansSerif',12)) # 这个静态方法设置了用于提示框的字体。
    18         # 这里使用10px大小的SansSerif字体。
    19         self.setToolTip('This is a <b>QWidget</b> widget') # 调用setTooltip()方法创建提示框。
    20         # 可以在提示框中使用富文本格式。
    21         
    22         btn = QPushButton('Button',self) # 创建按钮
    23         btn.setToolTip('This is a <b>QPushButton</b> widget') # 设置按钮提示框
    24         btn.resize(btn.sizeHint()) # 改变按钮大小
    25         
    26         btn.move(90,80) # 移动按钮位置
    27         
    28         self.setGeometry(400,350,260,200)
    29         self.setWindowTitle('show tips')
    30         self.show()
    31         
    32 if __name__ == "__main__":
    33     app = QApplication(sys.argv)
    34     ex = New_test()
    35     sys.exit(app.exec_())

    放置在按钮以外的空白区域的tips提示

     

    放置在Button上的tips提示

     

  • 相关阅读:
    接口测试和性能测试
    loadrunner总结
    loadrunner 基本操作
    loadrunner安装和应用
    qtp安装和使用
    Quality Center安装步骤
    JIRA的安装及配置
    testlink使用方法
    python3常用模块--熟练使用
    python2和python3差异
  • 原文地址:https://www.cnblogs.com/aziji/p/9641857.html
Copyright © 2011-2022 走看看