Python + Tkinter Windows 7 taskbar progress
progress, python, tkinter, windows
Solution
You can also use my library PyTaskbar like this:
import tkinter
import PyTaskbar # the module
class gui(object):
def __init__(self, root):
self.root = root
if __name__ == "__main__":
root = tkinter.Tk()
app = gui(root)
taskbar_progress = PyTaskbar.Progress(root.winfo_id()) # Instantiate a new progress object
taskbar_progress.init() # Initialize the progress bar
taskbar_progress.setState("normal") # Set the progress bar state to normal (Available: loading, normal, warning, error)
taskbar_progress.setProgress(50) # Set the progress bar value to 50%
root.mainloop()
It automatically handles all the things you need to do with comtypes, making it MUCH easier.
Docs: Here
Disclaimer: this library was made by me.
Problem
I want to show the progress of my app in a taskbar button. I used this answer as a reference. Here's an example of what I do: ``` import tkinter 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) class gui(object): def __init__(self, root): self.root = root if __name__ == "__main__": root = tkinter.Tk() app = gui(root) taskbar.HrInit() taskbar.SetProgressValue(root.winfo_id(),40,100) root.mainloop() ``` But I see no progress on a taskbar button. What do I do wrong?