+ 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)
+
+ #** Enable this to show putting a wxGLCanvas on the wxPanel
+ if 0:
+ c = CubeCanvas(self)
+ c.SetSize((200, 200))
+ box.Add(c, 0, wxALIGN_CENTER|wxALL, 15)
+
+ 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)