wx.py.shell.Shell

wx.py.shell.Shell
Hello,

I’m trying to embed a python shell in my wx app. I have checked how ShellFrame etc do it, and it seems it should be a no-brainer:

from wx.py.shell import Shell as PyShell

class MyFrame(wx.Frame):

 def __init__(self, …):

    … add other panels/sizers …

    self.shell = PyShell(self, -1)

        sizer_2.Add(self.shell, 1, wx.EXPAND, 0)

    ...

The shell panel is properly visible in the GUI, but no events seem to be handled by it: clicking does nothing, I can’t select and what I type does not appear in shell. The other panel properly handle stuff (button clicks etc). What am I missing?

Oliver

Oliver Schoenborn wrote:

Hello,

I'm trying to embed a python shell in my wx app. I have checked how ShellFrame etc do it, and it seems it should be a no-brainer:

from wx.py.shell import Shell as PyShell

class MyFrame(wx.Frame):
     def __init__(self, …):
        … add other panels/sizers …
        self.shell = PyShell(self, -1)
            sizer_2.Add(self.shell, 1, wx.EXPAND, 0)
        ...

The shell panel is properly visible in the GUI, but no events seem to be handled by it: clicking does nothing, I can't select and what I type does not appear in shell. The other panel properly handle stuff (button clicks etc). What am I missing?

Check the parentage of the widgets to make sure that the window hierarchy is as you expect it to be. For example, if you have a panel that fills the frame, but are making the shell be a direct child of the frame instead of the panel, then things like what you are seeing are possible.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!