]> git.saurik.com Git - wxWidgets.git/blob - wxPython/tests/wxFrame1.py
correction for Mac OS compilation
[wxWidgets.git] / wxPython / tests / wxFrame1.py
1 #Boa:Frame:wxFrame1
2
3 from wxPython.wx import *
4
5 import sys
6
7
8 def create(parent):
9 return wxFrame1(parent)
10
11 frame_count = 0
12
13 [wxID_WXFRAME1BUTTON1, wxID_WXFRAME1] = map(lambda _init_ctrls: wxNewId(), range(2))
14
15 class wxFrame1(wxFrame):
16 def _init_utils(self):
17 pass
18
19 def _init_ctrls(self, prnt):
20 wxFrame.__init__(self, size = wxSize(960, 662), id = wxID_WXFRAME1, title = 'wxFrame1', parent = prnt, name = '', style = wxDEFAULT_FRAME_STYLE, pos = (-1, -1))
21 self._init_utils()
22
23 self.button1 = wxButton(label = 'button1', id = wxID_WXFRAME1BUTTON1, parent = self, name = 'button1', size = wxSize(75, 23), style = 0, pos = wxPoint(216, 152))
24 EVT_BUTTON(self.button1, wxID_WXFRAME1BUTTON1, self.OnButton1Button)
25
26 def __init__(self, parent):
27 self._init_ctrls(parent)
28 global frame_count
29 frame_count += 1
30 self.SetTitle('Frame %d' % frame_count)
31 print 'Frame %d' % frame_count
32 self.shown = 0
33 EVT_IDLE(self, self.OnIdle)
34
35 def OnButton1Button(self, event):
36 print 'Closing %s' % self.GetTitle()
37 self.Close()
38
39 def OnIdle(self, evt):
40 if not self.shown:
41 #print self.GetTitle(), "shown"
42 #print self.Show(false), self.Show(true)
43 #import win32gui, win32con
44 #win32gui.ShowWindow(self.GetHandle(), win32con.SW_SHOW)
45 self.shown = 1
46
47
48 class BoaApp(wxApp):
49 def OnInit(self):
50 frame1 = create(None)
51
52 ## import win32gui, win32con
53 ## win32gui.ShowWindow(frame1.GetHandle(), win32con.SW_SHOW)
54 ## frame1.Show(true)
55
56 frame1.Show(true)
57 frame1.Show(false)
58 frame1.Show(true)
59
60 frame2 = create(None)
61 print frame2.Show(true)
62 return true
63
64 def main():
65 application = BoaApp(0)
66 application.MainLoop()
67
68 if __name__ == '__main__':
69 main()
70
71 ##if __name__ == '__main__':
72 ## app = wxPySimpleApp()
73 ##
74 ## frame1 = create(None)
75 ## frame1.Show(true)
76 ##
77 ## frame2 = create(None)
78 ## frame2.Show(true)
79 ##
80 ## app.MainLoop()
81 ##