[Tutor] Problems with Gauge Bar.

ALAN GAULD alan.gauld at btinternet.com
Mon Aug 11 17:42:20 CEST 2008


Including the list - please use ReplyAll.


Its the file that you want to scan - assuming there is a file.
It could be a list or anything else - I don't actually know from
your code what onScan is supposed to do! :-)

> Well, My code is supposed to do a lot. My actual onScan looks like this:

    def OnScan(self, event):
        startScan = '''TSO will now start creating a log.
Please be patient as this can take from 5 up to 10 minutes.
Please press OK to start TSO.'''
        dlg2 = wx.MessageDialog(self, startScan, 'Starting TSO.', wx.OK|wx.ICON_INFORMATION)
        dlg2.ShowModal()
        dlg2.Destroy()

        scan()
        
        dlg = wx.MessageDialog(self, 'The log is done.\n Press OK to return to TSO.', 
                                              'Done Creating Log.',    wx.OK|wx.ICON_INFORMATION)
        dlg.ShowModal()
        dlg.Destroy()

> the part that calls for the features in TSO (scan()) is simply defined later in the program 
> (out of the class I might add). Is this a problem for the gauge bar?

Possibly. For the guage to display progress it needs a way to get the intermediate 
progress. If the scan() function updates some global variable or has a hook function 
to call for periodic update then all is well. But if it is a single monolithic bit of code 
there is very little you can do. 

Given the scan() function is external to the GUI - as it should be - then I'd probably 
opt for running scan() inside a thread and using a non-modal dialog to indicate that 
the scan is running - maybe with a simple timer display to show that its still running. 
Then at the end of the scam either just delete the dialog or bring it to the top to make 
the user delete it - thus seeing that the scan is complete. By making it non-modal 
the user can carry on using the GUI while scanning.

 > (Let me know if you need to know the complete scan() code as well.
Probably not since I'm guessing it is basically a single loop with no breakouts 
or callback hooks.

Alan G.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080811/211a77d7/attachment-0001.htm>


More information about the Tutor mailing list