[Tkinter-discuss] bwidget progression dialog

Stewart Midwinter stewart.midwinter at gmail.com
Mon Nov 29 21:18:42 CET 2004


It appears that the progression dialog (shows a little rectangle that
oscillates back and forth to indicate progress of a process) would be
quite useful in what I'm doing.

Does anyone have a sample code of how to set it up under Python?  I
can get the progression dialog to pop up, but I'm clearly lacking in
understanding how to display the oscillating rectangle or have it
update.   My sample code below includes the TCL code that displays the
progression dialog and its bar.

===
# sample code

from Tkinter import *
from bwidget import *


t = Tk()
b = Button(t, relief=LINK, text="Quit (using bwidget)", command=t.destroy)
b.pack()
c = ProgressDialog(t, title="Please wait...", 
                    type="infinite", 
                    width=20, 
                    stop="Stop",
                    )
#d = Button(c, text="end", command=c.destroy)
t.mainloop()

"""from Tkinter import *
from bwidget import *

progmsg = "Compute in progress..."
progval = 0

t = Tk()
b = Button(t, relief=LINK, text="Quit (using bwidget)", command=t.destroy)
b.pack()
c = ProgressDialog(t, title="Please wait...", 
                    type="infinite", 
                    width=20, 
                    stop="Stop",
                    textvariable = progmsg,
                    variable = progval
                    )
#d = Button(c, text="end", command=c.destroy)
t.mainloop()

"""
TCL code from tmpldlg.tcl that creates a progression dialog:

proc DemoDlg::_show_progdlg { } {
    set DemoDlg::progmsg "Compute in progress..."
    set DemoDlg::progval 0

    ProgressDlg .progress -parent . -title "Wait..." \
        -type         infinite \
        -width        20 \
        -textvariable DemoDlg::progmsg \
        -variable     DemoDlg::progval \
        -stop         "Stop" \
        -command      {destroy .progress}
    _update_progdlg
}


proc DemoDlg::_update_progdlg { } {
    if { [winfo exists .progress] } {
        set DemoDlg::progval 2
        after 20 DemoDlg::_update_progdlg
    }
}

"""



cheers,
-- 
Stewart Midwinter
stewart at midwinter.ca
stewart.midwinter at gmail.com


More information about the Tkinter-discuss mailing list