[Tutor] Problems with Gauge Bar.

Olrik Lenstra o.lenstra at gmail.com
Tue Aug 12 00:20:38 CEST 2008

> Including the list - please use ReplyAll.

Sorry. Pressed the wrong button.

> 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.',
>         dlg2.ShowModal()
>         dlg2.Destroy()
>         scan()
>         dlg = wx.MessageDialog(self, 'The log is done.\n Press OK to return
> to TSO.',
>                                               'Done Creating Log.',
>         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.

Not sure what you mean. My code calls different built in functions from
windows. (Like Ipconfig, ping etc.)
The only thing I do is call them from python, make sure that the format is
right and write it to a file. (called temp.txt)
Once temp.txt is complete it goes through a script which makes the text
'cross platform' so it shows 'nice' on forums.

I'll make a little attempt to this. Not sure how it will go.

> 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.

Yes the scan() functions are external to the GUI. I simply made the code
first and the GUI later.

>  > (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.

I'll take your word for that. ;)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080812/4005b141/attachment.htm>

More information about the Tutor mailing list