簡體   English   中英

python的Tkinter中的Windows進度條

[英]Windows progress bar in python's Tkinter

有沒有辦法在python的Tkinter,bwidget或類似的東西顯示Windwos的默認進度條? 我已經知道了bwidget.ProgressBar,但它產生了一個丑陋的進度條,而我的意思是顯示一個有效的Windows進度條 - 綠色,發光的:

http://imageshack.us/photo/my-images/853/unledtph.png/

我需要它,因為Windows會自動在任務欄中顯示我的程序的進度。 而且,它看起來更好。

如果您使用的是現代(2.7+)版本的Tkinter,您可以嘗試ttk.ProgressBar ,它是Tkinter的一部分。

您可以單獨安裝pyttk模塊。

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

就任務欄功能而言,Tkinter尚未提供(至少據我所知)。 您需要為此使用Windows API。 雖然這個問題適用於PyQt,但答案應該證明是有幫助的。 希望它能讓你開始。

最簡單的解決方案似乎是使用主題Tk和Python 2.7和3.1中包含的tkinter.ttk模塊。 Progressbar小部件是您想要的。

由於您似乎正在考慮使用其他框架,因此您可能會看到Qt或wxWidgets,它們看起來很原生且具有出色的Python綁定。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM