开发者

Windows progress bar in python's Tkinter

开发者 https://www.devze.com 2023-03-14 01:48 出处:网络
Is there any way in python\'s Tkinter, bwidget or anything similar to show a Windwos\' default progress bar?

Is there any way in python's Tkinter, bwidget or anything similar to show a Windwos' default progress bar? I already know the bwidget.ProgressBar, but it produces an ugly progress bar while I mean showing a valid windows progress bar - the green, glowing one:

http:开发者_如何学运维//imageshack.us/photo/my-images/853/unledtph.png/

I need it because that way Windows will automatically show the progress of my program in the task bar. Plus, it looks better.


If you are using a modern (2.7+) version of Tkinter you can try the ttk.ProgressBar which is part of Tkinter.


You can install the pyttk module separately.

from Tkinter import *
import ttk
root = Tk()
progressbar = ttk.Progressbar(orient=HORIZONTAL, length=200, mode='determinate')
progressbar.pack(side="bottom")
progressbar.start()
root.mainloop()

As far as the taskbar functionality, that is not available in Tkinter yet (at least to the best of my knowledge). You'll need to make use of the Windows API for that. Although this question is for PyQt, the answers should prove helpful. Hope it gets you started.


The simplest solution would appear to be to use themed Tk with the tkinter.ttk module included in Python 2.7 and 3.1. The Progressbar widget is what you want.

Since you appear to be considering other frameworks you might look at Qt or wxWidgets which look native and have excellent Python bindings.

0

精彩评论

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