]> git.saurik.com Git - wxWidgets.git/blame - wxPython/tests/alternateThread.py
some updates for new methods, constants, etc.
[wxWidgets.git] / wxPython / tests / alternateThread.py
CommitLineData
6e18ca6c
RD
1from time import sleep
2from threading import Thread
3
4def test_a_window():
5 print "starting window thread"
6
7 from wxPython.wx import * # <-- the wxWin DLL is not loaded until here
8
9 app = wxPySimpleApp(1)
10 frame = wxFrame(None, -1, "Hello", size=(400,200))
11 frame.Show(true)
12 EVT_SIZE(frame, OnFrameSize)
13 app.MainLoop()
14 print "finishing window thread"
15
16def OnFrameSize(evt):
17 print evt.GetSize()
18
19
20
21keep_going = 1
22def counter():
23 print "starting counter thread"
24 count = 0
25 while keep_going:
26 sleep(1)
27 count += 1
28 print count
29 print "finishing counter thread"
30
31def main():
32 print "main startup"
33
34 ct = Thread(target=counter)
35 wt = Thread(target=test_a_window)
36
37 ct.start()
38 wt.start()
39 wt.join()
40
41 global keep_going
42 keep_going = 0
43
44 ct.join()
45
46 print "main finished"
47
48main()
49
50
51
52