wxPython before MainLoop

kyosohma at gmail.com kyosohma at gmail.com
Thu Aug 9 15:03:34 CEST 2007


On Aug 9, 12:25 am, "[david]" <da... at nospam.spam> wrote:
> I'd like to refresh the display before I start the main loop.
>
> I have code like this:
>
> app = App()
> app.Show()
> app.long_slow_init()
> app.MainLoop()
>
> The main frame partly loads at Show, but because the mainloop has not
> started yet, the display does not update until long_slow_init() finishes.
>
> Alternatively, I could code
>
> app = App()
> app.long_slow_init()
> app.Show()
> app.MainLoop()
>
> Which would give me a crisp Show, but there would be a long slow wait
> before the app showed any activity at all. I would need a splash screen.
>
> I'd rather not have a splash screen (and I don't know how anyway). I'd
> like to just make app.Show() finish correctly before running
> long_slow_init.
>
> Is there a wx internal method that I can use to give Windows the
> opportunity to finish painting the frame before I run long_slow_init()?
>
> Or is there a better idea?
>
> (david)

Yeah, I think 7stud's thread is the way to go. It's what I do with
long running tasks, see also:
http://wiki.wxpython.org/LongRunningTasks

If your screen doesn't load correctly, be sure to call the Layout()
method.

Mike




More information about the Python-list mailing list