Python and wx questions

Hi !

More of questions I have.
I want to port an Delphi program to wxPython/Python.
Please help me !

1.
When I write an wx application that is making a long time
process of datas, how I avoid the blank windows, how I refresh ?
I think the solution is thread, but I don't know (in Python).

1.a.
How I create a thread procedure ?

1.b.
How I send a signal to main thread ?

1.c.
How I terminate the process thread ?

1.d
How I protect the shared data from cross writing of threads ?
(Have a mutex or other (critical section ?))

2.
How I allocate a fixed length list in one command ?
Have the Python a command to allocate in one step ?
Like:
SetLength(List,50);
I want more efficiency than this:
List=[];for i in range(0,50):List.Add(None)
or a shorter code.

3.
Have the wx an timer or a dummy procedure ?
I want it to use to periodically get the process thread's datas
(report), and write it to log memo.
Have I register my owned dummy proc ?

Thanx for the answer, or I you send me an url or example to I learn
it:
KK

Krisztian Kepes wrote:

1.
When I write an wx application that is making a long time
process of datas, how I avoid the blank windows, how I refresh ?
I think the solution is thread, but I don't know (in Python).

See:

http://wiki.wxpython.org/index.cgi/LongRunningTasks
and:

http://wiki.wxpython.org/index.cgi/WorkingWithThreads

http://www.python.org/doc/lib/module-threading.html

as well as comp.lang.python and other assorted Python docs, for the
non-wxPython specific stuff.

2.
How I allocate a fixed length list in one command ?
Have the Python a command to allocate in one step ?
Like:
SetLength(List,50);
I want more efficiency than this:
List=;for i in range(0,50):List.Add(None)
or a shorter code.

List = [None] * 50

or use and array.array:

http://www.python.org/doc/current/lib/module-array.html

Or a Numeric array:

http://www.pfdubois.com/numpy/

if you want to store/manipulate numbers.

3.
Have the wx an timer or a dummy procedure ?
I want it to use to periodically get the process thread's datas
(report), and write it to log memo.
Have I register my owned dummy proc ?

I'm not quite sure I understand this one, but it sounds like a wxTimer
is just what you need. YOu could also use a thread timer, if you are
using threads anyway.

http://www.python.org/doc/lib/timer-objects.html
-Chris

ยทยทยท

--
Christopher Barker, Ph.D.
Oceanographer
                                        
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov