PyShell Hangs

I’m sure this is another newbie question, but why does my PyShell in this
example just hang and refuse

to accept input?

`import string

import wx

import wx.py as py

class MyFrame(wx.Frame):

def __init__(self, parent, ID, title):

    wx.Frame.__init__(self,

parent, ID, title,

wx.DefaultPosition, wx.Size(640, 480))

    self.CreateStatusBar()

    self.SetStatusText("This

is the statusbar")

    menu = wx.Menu()

    menu.Append(wx.ID_EXIT,

“E&xit”, “Terminate the program”)

    menuBar = wx.MenuBar()

    menuBar.Append(menu,

“&File”);

self.SetMenuBar(menuBar)

    wx.EVT_MENU(self,

wx.ID_EXIT, self.TimeToQuit)

def TimeToQuit(self, event):

    self.Close(True)

class MyPanel(wx.Panel):

def __init__(self, parent, id):

    wx.Panel.__init__(self,

parent, id)

sizer=wx.BoxSizer(wx.VERTICAL)

self.shell=py.shell.Shell(parent, -1, introText=“A
PyShell”)

sizer.Add(self.shell,1,wx.EXPAND)

self.SetSizerAndFit(sizer)

class MyApp(wx.App):

def OnInit(self):

    self.frame = MyFrame(None, -1,

“Test”)

    self.panel =

MyPanel(self.frame, -1)

    self.frame.Show(True)

self.SetTopWindow(self.frame)

    return True

app = MyApp(None)

app.MainLoop(`

Change 'parent' to 'self' in this line

  self.shell=py.shell.Shell(parent, -1, introText="A PyShell")

and that makes the program work on our system**.

/Jean Brouwers
ProphICy Semiconductor, Inc.

**) wxPython 2.4.1.2 and Python 2.3 on RedHat Linux 8.0 with gtk2.

Peter L. Buschman wrote:

···

I'm sure this is another newbie question, but why does my PyShell in this example just hang and refuse
to accept input?

import string
import wx
import wx.py as py

class MyFrame(wx.Frame):
    def __init__(self, parent, ID, title):
        wx.Frame.__init__(self, parent, ID, title,
                         wx.DefaultPosition, wx.Size(640, 480))
        self.CreateStatusBar()
        self.SetStatusText("This is the statusbar")

        menu = wx.Menu()
        menu.Append(wx.ID_EXIT, "E&xit", "Terminate the program")

        menuBar = wx.MenuBar()
        menuBar.Append(menu, "&File");

        self.SetMenuBar(menuBar)

        wx.EVT_MENU(self, wx.ID_EXIT, self.TimeToQuit)

    def TimeToQuit(self, event):
        self.Close(True)

class MyPanel(wx.Panel):
    def __init__(self, parent, id):
        wx.Panel.__init__(self, parent, id)
        sizer=wx.BoxSizer(wx.VERTICAL)
        self.shell=py.shell.Shell(parent, -1, introText="A PyShell")
        sizer.Add(self.shell,1,wx.EXPAND)
        self.SetSizerAndFit(sizer)

class MyApp(wx.App):
    def OnInit(self):
        self.frame = MyFrame(None, -1, "Test")
        self.panel = MyPanel(self.frame, -1)
        self.frame.Show(True)
        self.SetTopWindow(self.frame)
        return True

app = MyApp(None)
app.MainLoop(