Last active
August 29, 2015 14:28
-
-
Save saleph/b44d19436fe70e74fc4f to your computer and use it in GitHub Desktop.
[qt5] tooltips
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = 'tom' | |
import sys | |
from PyQt5.QtWidgets import (QWidget, QToolTip, | |
QPushButton, QApplication) | |
from PyQt5.QtGui import QFont | |
class Example(QWidget): | |
def __init__(self): | |
super().__init__() | |
self.init_ui() | |
def init_ui(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_()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment