embed ipython in wxPython app
chewie54
dfabrizio51 at gmail.com
Mon Nov 19 12:51:02 EST 2007
On Nov 18, 8:39 pm, chewie54 <dfabrizi... at gmail.com> wrote:
> Hi All,
>
> I'm evaluting IPython to see if I can it use like Tcl and Tk. If I
> start wish8.4, I get a command line
> interpreter in xterm, then I can source tcl progams that draw tk
> graphics on a canvas in another window.
>
> Is there a way to embed IPython in a wxPython app to do that?
> When I do as shown in the example below the GUI window does not show
> until I exit IPython.
>
> Thanks in advance for any help with this,
>
> import wx
> from IPython.Shell import IPShellEmbed
>
> class MyFrame(wx.Frame):
> def __init__(self,parent=None, id=-1, title=' '):
> wx.Frame.__init__(self,parent,id,title,size=(200,140))
> top = wx.Panel(self)
> sizer = wx.BoxSizer(wx.VERTICAL)
> lb = wx.StaticText(top,-1,'Animals(in pairs; min,pair,
> max,dozen)')
> sizer.Add(lb)
>
> top.SetSizer(sizer)
> self.Layout()
>
> class MyApp(wx.App):
> def OnInit(self):
> frame = MyFrame(title="wxWidgets")
> frame.Show(True)
> self.SetTopWindow(frame)
> return True
>
> def main():
> ipshell = IPShellEmbed()
> ipshell()
> app = MyApp()
> app.MainLoop()
>
> if __name__ == '__main__':
> main()
I forgot to mention.
I did see an example of embedding IPython in a PyGTK app on
http://ipython.scipy.org/moin/Cookbook
It would be nice to see an example that shows how to embed
IPython in a wxPython or Tkinter GUI app.
More information about the Python-list
mailing list