#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Py40 PyQt5 tutorial
This example shows a tooltip on
a window and a button.
author: Jan Bodnar
website: py40.com
last edited: January 2015
"""
import sys
from PyQt5.QtWidgets import (QWidget, QToolTip,
QPushButton, QApplication,QLabel)
from PyQt5.QtGui import QFont
from PyQt5 import QtCore,QtGui, QtWidgets
class Example(QWidget):
def __init__(self):
super().__init__()
self.initUI()
def fun1(self):
print('aaaaaaaaa')
def initUI(self):
# 这种静态的方法设置一个用于显示工具提示的字体。我们使用10px滑体字体。
QToolTip.setFont(QFont('SansSerif', 10))
# 创建一个提示,我们称之为settooltip()方法。我们可以使用丰富的文本格式
#self.setToolTip('This is a <b>QWidget</b> widget