[PyQt] Application not hiding from taskbar

Mikael Modin micke.modin at gmail.com
Fri Dec 3 13:40:17 GMT 2010


Hi,

I'm trying to implement minimize-to-tray but my application refuses to
hide from taskbar. I've distilled the problematic code down to this
little snippet, attached .ui-file.

import sys, os
from PyQt4 import uic
from PyQt4.QtGui import QMainWindow, QApplication

class MyClass(QMainWindow):
    def __init__(self, parent = None):
        QMainWindow.__init__(self, parent)
        self.ui = uic.loadUi(os.path.join("gui",
"timeTrackerClientGUI.ui"), self)
    def hideEvent(self, event):
        self.hide()

if __name__ == '__main__':
    app = QApplication(sys.argv)
    wnd = MyClass()
    wnd.show()
    app.exec_()

According to http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qwidget.html#hideEvent
I get a hideEvent when the user minimizes the window and that part
works, but self.hide() doesn't hide my window from the taskbar. It's
working fine in Linux, but in Windows 7 it refuses to hide. It looks
like one icon hides but then another one pops up beside it, if I click
quick enough you get this flickering effect I managed to catch in a
screenshot, http://dl.dropbox.com/u/3184097/problem2.png
I'm stumped, thought this would be simple to do.

Kind regards
Mikael Modin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: timeTrackerClientGUI.ui
Type: application/octet-stream
Size: 9684 bytes
Desc: not available
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20101204/d788f6a1/attachment.obj>


More information about the PyQt mailing list