- def runTest(frame, nb, log):
- win = wxFrame(frame, -1, "GL Demos", wxDefaultPosition, wxSize(300,300))
- CubeCanvas(win)
- #MySplitter(win)
- frame.otherWin = win
- win.Show(true)
- return None
+ buttonDefs = {
+ wxNewId() : ('CubeCanvas', 'Cube'),
+ wxNewId() : ('ConeCanvas', 'Cone'),
+ }
+
+ class ButtonPanel(wxPanel):
+ def __init__(self, parent, log):
+ wxPanel.__init__(self, parent, -1)
+ self.log = log
+
+ box = wxBoxSizer(wxVERTICAL)
+ box.Add(20, 30)
+ keys = buttonDefs.keys()
+ keys.sort()
+ for k in keys:
+ text = buttonDefs[k][1]
+ btn = wxButton(self, k, text)
+ box.Add(btn, 0, wxALIGN_CENTER|wxALL, 15)
+ EVT_BUTTON(self, k, self.OnButton)
+
+ self.SetAutoLayout(true)
+ self.SetSizer(box)
+
+ def OnButton(self, evt):
+ canvasClassName = buttonDefs[evt.GetId()][0]
+ canvasClass = eval(canvasClassName)
+ frame = wxFrame(None, -1, canvasClassName, size=(400,400))
+ canvas = canvasClass(frame)
+ frame.Show(true)