[Tkinter-discuss] bwidget progressbar

Michael Lange klappnase at web.de
Thu Sep 14 10:26:07 CEST 2006


On Wed, 13 Sep 2006 15:50:47 +0300
"Ilknur Ozturk" <Ilknur.Ozturk at cabot.com.tr> wrote:

> Thanks Michael,
> 
> I am new in Tk() and it will good for me if I can find samples for its
> usage. I found some on internet but they are very complex for me. In man
> pages, the options and methods are listed but there is no basic sample
> of them:(
> 

Hi Ilknur,

usually Tk man pages are quite straightforward to "translate" into Python.
The standard and widget-specific options in Tk begin with "-" (like -height),
in Python you can pass them to the widget constructor or to configure(), like
widget.configure(height=20). The WIDGET COMMAND section describes the
available commands for the widget, in case of the ProgressBar there is only
cget() and configure().

So an (untested) example according to the man page might look like:

from Tkinter import *
import bwidget

root = Tk()
var = IntVar()
var.set(0)
p = bwidget.ProgressBar(root, height=20, width=200, maximum=100, variable=var, type='normal')
p.pack()

def run_test():
    if var.get() < 100:
        var.set(var.get() + 1)
        root.after(50, run_test)
run_test()

root.mainloop()

I hope this helps

Michael


More information about the Tkinter-discuss mailing list