progress bar controls in status.py

mirandacascade at yahoo.com mirandacascade at yahoo.com
Tue Feb 22 23:16:03 EST 2005


O/S - Windows XP Home with Service Pack 2
Vsn of Python: 2.4 (from ActiveState)

This question is with regard to the progress bar controls that are in
the file status.py.  On my workstation, status.py is located in the:

c:\python24\lib\site-packages\pythonwin\pywin\dialogs\

folder.

The only modification I made to status.py was to the demo() method
where I added the type argument and then called either
StatusProgressDialog or ThreadedStatusProgressDialog.  The modified
demo() method looks like this:

def demo(type):
    if type == "threaded":
        d = ThreadedStatusProgressDialog("A Demo", "Doing
something...")
    else:
        d = StatusProgressDialog("A Demo", "Doing something...")

	import win32api
	for i in range(100):
            if i == 50:
	        d.SetText("Getting there...")
		if i==90:
		    d.SetText("Nearly done...")
		win32api.Sleep(20)
		d.Tick()
	d.Close()

Using the interactive window of PythonWin, when I do the following:
>>> import status
>>> status.demo('a')
the results are:
 - a progress bar with title 'A Demo' appears
 - ticks appear within the progress bar
 - the message changes from 'Doing something' to 'Getting there...' to
'Nearly done...'
 - the progress bar no longer appears

Using the interactive window of PythonWin, when I do the following:
>>> import status
>>> status.demo('threaded')
the results are:
 - the cursor position stays immediately to the right of the ')'
character
 - nothing appears on the screen
 - about 10 seconds later the >>> appears, a progress bar control
appears with the title 'A Demo' and text 'Doing something'
 - the progress bar remains visible until I close it by clicking on the
X in the top right corner

My questions are:
1) If I want the behavior of ThreadedStatusProgressDialog to emulate
the behavior of StatusProgressDialog, what changes must I make to
status.py to accomplish that? (assume that I want
ThreadedStatusProgressDialog to remain threaded, i.e. I'm not looking
for an answer along the lines of "if you want the behavior of
ThreadedStatusProgressDialog to emulate the behavior of
StatusProgressDialog, then have it call StatusProgressDialog.")
2) Can you offer any guidelines or rules of thumb regarding when one
would wish to use ThreadedStatusProgressDialog vs using
StatusProgressDialog?




More information about the Python-list mailing list