[wxPython] refresh wxPython dialog??

I think there are two choices:

- Start your time consuming function in a new thread.

- Start your time consuming function in a new process.

Multi-threaded programming can get quite tricky. Starting a new process works differently on Unix (fork) and Windows (spawn). It is not easy to decide what is the better approach.

There is a section on "Thread Basics" in Beazley's "Essential Python Reference".

Ralf

···

--

On Tue, 5 Sep 2000 11:03:54 Rafael Spyra wrote:

Hello,

I am using a wxPython dialog which starts a time consuming function (ca. 1-3
min.).
At this time the dialog do not refresh any controls, e.g. wxTextCtrl!!
How can I refresh this controls and make sure, that the cancel-button works
every time???

Have anybody an idea??

Regards
Rafael

_______________________________________________
wxPython-users mailing list wxPython-users@wxwindows.org
http://wxwindows.org/mailman/listinfo/wxpython-users

--== Sent via Deja.com http://www.deja.com/ ==--
Before you buy.

Ralf Grosse-Kunstleve wrote:

I think there are two choices:

- Start your time consuming function in a new thread.

- Start your time consuming function in a new process.

There's another option: modify the MainLoop function of wxApp. Something like:

class MyApp(wxApp):
    def OnInit(self):
        # whatever

    def MainLoop(self):
        while(1):
            while self.Pending():
                self.Dispatch()
            self.MyStuff()

Or put the calculation in a function that is called when Wx is idle:

class MyApp(wxApp):
    def OnInit(self):
        # whatever
        EVT_IDLE(self, self.OnIdle)
        return true

    def OnIdle(self, event):
        print "Python is cool."

Cheers,

···

--
Thomas Hamelryck Institute of Molecular and Structural Biology
Aarhus University Gustav Wieds Vej 10C DK-8000 Aarhus C Denmark
                 http://zombie.imsb.au.dk/~tham