您的位置:首页 > 编程语言 > Qt开发

pyqt5 学习

2016-01-20 10:17 134 查看

添加提示信息

#!/usr/bin/python3
# -*- coding: utf-8 -*-

"""
ZetCode PyQt5 tutorial

This example shows a tooltip on
a window and a button.

author: Jan Bodnar
website: zetcode.com
last edited: January 2015
"""

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):

QToolTip.setFont(QFont('SansSerif', 10))

self.setToolTip('This is a <b>QWidget</b> widget')

btn = QPushButton('Button', self)
btn.setToolTip('This is a <b>QPushButton</b> widget')
btn.resize(btn.sizeHint())
btn.move(50, 50)

self.setGeometry(300, 300, 300, 200)
self.setWindowTitle('Tooltips')
self.show()

if __name__ == '__main__':

app = QApplication(sys.argv)
ex = Example()
sys.exit(app.exec_())
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: