+ def OnOpenShellWindow(self, evt):
+ if self.shell:
+ # if it already exists then just make sure it's visible
+ s = self.shell
+ if s.IsIconized():
+ s.Iconize(False)
+ s.Raise()
+ else:
+ # Make a PyShell window
+ from wx import py
+ namespace = { 'wx' : wx,
+ 'app' : wx.GetApp(),
+ 'frame' : self,
+ }
+ self.shell = py.shell.ShellFrame(None, locals=namespace)
+ self.shell.SetSize((640,480))
+ self.shell.Show()
+
+ # Hook the close event of the main frame window so that we
+ # close the shell at the same time if it still exists
+ def CloseShell(evt):
+ if self.shell:
+ self.shell.Close()
+ evt.Skip()
+ self.Bind(wx.EVT_CLOSE, CloseShell)
+
+