Thanks Chris!
That one-liner did the trick for me. However, there's no mention of it in
the help-file that comes with 2.7.1---I guess I need some google-training.
Thanks again,
Greger
···
-----Original Message-----
From: Chris Mellon [mailto:arkanes@gmail.com]
Sent: den 11 december 2006 17:47
To: wxPython-users@lists.wxwidgets.org
Subject: Re: [wxPython-users] Knowing when the MainLoop is runningOn 12/11/06, Greger Cronquist <greger.cronquist@niradynamics.se> wrote:
>
>
>
>
> Hi,
>
>
>
> I'm rather new to wxPython so I stumbled into the following problem:
>
>
>
> I have an app that displays a list of files (with some info) in a
TreeCtrl,
> and one of the ways to specify which folders it reads files from is via
the
> command line. So I have (essentially)
>
>
>
> class GUI(wx.App):
>
> ...
>
>
>
>
>
> if __name__ == '__name__':
>
> gui = GUI(False)
>
> gui.add_files(sys.argv[1:])
>
> gui.MainLoop()
>
>
>
>
>
> Now, since extracting the info I show takes some time, I show a
> ProgressDialog with a Cancel button on. But, if the files are given at
the
> command line, and event handling isn't up and running, the Cancel button
> doesn't work. So, I want add_files to just add the files to a list, and
not
> update the TreeCtrl until the MainLoop is up and running. I tried using
> implementing wx.App.OnRun, but to no avail.
>
>You can use wx.CallAfter to delay a call until the event loop is up
and running. In your example you could use wx.CallAfter(gui.add_files,
sys.argv[1:]), and this code would execute at some point after the
event loop has started.---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org