windows - Detecting if the win7 desktop is shown with python and Qt -


i want check if desktop of windows 7 shown (e.g. after clicking control+d or showdesktop-button).

it meant application i've set qtcore.qt.framelesswindowhint make decorations disappear. after desktop shown , minimized, want reshow app (this should optional , user can set or unset behaviour).

i tested in idle. want detect change if show desktop, still there "1" printed. if close(destroy) window, changes "0", thats not searching for...

from pyqt4 import qtgui, qtcore pyqt4.qtcore import * pyqt4.qtgui import * import sys import win32gui import time  class main(qwidget):     def __init__(self, app):         qtgui.qwidget.__init__(self)         self.app=app         self.window=qwidget()         self.window.resize(200,100)         self.window.setwindowtitle("dummy")         #self.window.setwindowflags(qtcore.qt.framelesswindowhint)         self.window.show()          self.check_minimized_thread=worker(self)          self.check_minimized_thread.start()          self.app.exec_()  class worker(qthread):     def __init__(self, parent = none):         qthread.__init__(self, parent)         self.exiting = false      def __del__(self):         self.exiting = true         self.wait()      def run(self):         while true:             time.sleep(0.5)             hwnd=win32gui.findwindow(none,"dummy")             a=win32gui.iswindowvisible(hwnd)             print(a)          self.exit()   if __name__ == '__main__':     app=qapplication(sys.argv)     main(app) 


Comments