开发者

Tooltips not showing up on Ubuntu using PyQt4

开发者 https://www.devze.com 2023-01-15 02:55 出处:网络
I\'m getting started with PyQt4 and tested the following code... import sys from PyQt4 import Qt开发者_运维百科Gui

I'm getting started with PyQt4 and tested the following code...

import sys
from PyQt4 import Qt开发者_运维百科Gui
from PyQt4 import QtCore


class Tooltip(QtGui.QWidget):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)

        self.setGeometry(300, 300, 250, 150)
        self.setWindowTitle('Tooltip')

        self.setToolTip('This is a <b>QWidget</b> widget')
        QtGui.QToolTip.setFont(QtGui.QFont('OldEnglish', 10))


app = QtGui.QApplication(sys.argv)
tooltip = Tooltip()
tooltip.show()
sys.exit(app.exec_())

However, no tooltip shows up! I'm on Ubuntu 10.04. I also tried an icon and that didn't work either.


If the window you start your application from ( e.g. your terminal ) is active, hovering over your application will not show a Tooltip. As Ivo indicated you need to make the window of your application active for the Tooltips to show up.

0

精彩评论

暂无评论...
验证码 换一张
取 消