Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PyQt4 import QtCore, QtGui
- from PyQt4.QtCore import SIGNAL
- TBPF_NOPROGRESS = 0
- TBPF_INDETERMINATE = 0x1
- TBPF_NORMAL = 0x2
- TBPF_ERROR = 0x4
- TBPF_PAUSED = 0x8
- class MyMainWindow(QtGui.QMainWindow):
- def __init__(self, parent=None):
- QtGui.QMainWindow.__init__(self, parent)
- self.setWindowTitle("Windows 7 Taskbar Test")
- self.progressbar = QtGui.QProgressBar(self)
- self.setCentralWidget(self.progressbar)
- self.progressbar.setRange(0,100)
- self.timer = QtCore.QTimer(self)
- self.timer.setInterval(100)
- self.connect(self.timer, SIGNAL("timeout()"), self.timer_timeout)
- self.progress = 0
- self.timer.start()
- def timer_timeout(self):
- import comtypes.client as cc
- cc.GetModule("TaskbarLib.tlb")
- import comtypes.gen.TaskbarLib as tbl
- taskbar = cc.CreateObject(
- "{56FDF344-FD6D-11d0-958A-006097C9A090}",
- interface=tbl.ITaskbarList3)
- taskbar.HrInit()
- hWnd = self.winId()
- self.progress += 2
- if self.progress > 100:
- self.progress = 0
- self.progressbar.setValue(self.progress)
- taskbar.SetProgressValue(hWnd,self.progress,100)
- taskbar.SetProgressState(hWnd, TBPF_NORMAL)
- if __name__ == "__main__":
- import sys
- app = QtGui.QApplication(sys.argv)
- ui = MyMainWindow()
- ui.show()
- sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement