zoukankan      html  css  js  c++  java
  • 为部件提供浮动提示信息

    效果如下(由于不方便截图,就另存了教程中的图片):

                                   (加上提示信息即为实际截图)

     1 """
     2 This example shows a tooltip on
     3 a window and a button.
     4 """
     5 import sys
     6 from PyQt5.QtWidgets import (QWidget, QToolTip, QPushButton, QApplication)
     7 from PyQt5.QtGui import QFont
     8 
     9 
    10 class Example(QWidget):
    11 
    12     def __init__(self):
    13         super().__init__()
    14         self.initUI()
    15 
    16     def initUI(self):
    17 
    18         # We use a 10px SansSerif font.
    19         QToolTip.setFont(QFont('SansSerif', 10))
    20         # This static method sets a font used to render tooltips.
    21 
    22         # To create a tooltip, we call the setTooltip() method.
    23         self.setToolTip('This is a <b>QWidget</b> widget')
    24 
    25         # create a push button widget and set a tooltip for it
    26         btn = QPushButton('Button', self)
    27         btn.setToolTip('This is a <b>QPushButton</b> widget')
    28         btn.resize(btn.sizeHint())
    29         # The sizeHint() method gives a recommended size for the button
    30         
    31         btn.move(50, 50)
    32 
    33         self.setGeometry(300, 300, 300, 200)
    34         self.setWindowTitle('Tooltips')
    35         self.show()
    36 
    37 
    38 if __name__ == '__main__':
    39 
    40     app = QApplication(sys.argv)
    41     ex = Example()
    42     sys.exit(app.exec_())
  • 相关阅读:
    Hive数据倾斜原因和解决办法(Data Skew)
    Hive简介
    SQL---公共表表达式(CTEs)
    SQL面试题---topN问题
    SQL---分页查询
    SQL---自连接(self join)
    SQL---关联子查询(correlated subquery)
    SQL---CASE表达式
    SQL查询语句执行顺序
    SQL---窗口函数(window function)
  • 原文地址:https://www.cnblogs.com/fuqia/p/8697780.html
Copyright © 2011-2022 走看看