[wxPython-users] Re: Need Help with wx.py.shell !!!

Raffaello Barella barbarossa.platz at gmail.com
Thu Mar 20 13:53:55 PDT 2008


Sorry to meddle in but, Mike, could you please give the full address or a
copy of the Demo you are speaking of? Thanks.

2008/3/20, Mike Driscoll <mdriscoll at co.marshall.ia.us>:
>
> Trey K wrote:
> > Hey all,
> > I'm running on a bit of a tight schedule, and I need help with a
> > wxpython app.
> > Here's a dialog for running some code:
> >
> >     |import sys
> >     import os
> >     import wx
> >         def OnRun(self, event):
> >             class RunDialog(wx.Dialog):
> >                 def __init__(self, parent, eCode):
> >                     wx.Dialog.__init__(self, parent, title=3D("Run..."))
> >                     self.eCode =3D eCode
> >
> >                     self.MakeRunCode()
> >
> >                     f =3D
> >     open(os.path.abspath(os.path.dirname(sys.argv[0])) +
> >     "/tempcode.pyw", 'w')
> >                     f.write(self.eSaveCode)
> >                     f.close()
> >
> >                     pyshl =3D py.shell.Shell(self, -1,
> >     introText=3D"Running your Element program in its Pythonic
> >     equivalent...\n")
> >
> >     pyshl.runfile(os.path.abspath(os.path.dirname(sys.argv[0])) +
> >     "/tempcode.pyw")
> >                 def ShowECompileProblem(self, eName):
> >                     dlg =3D wx.MessageDialog(None, eName, 'Error while
> >     running...', wx.OK | wx.ICON_INFORMATION)
> >                     dlg.ShowModal()
> >                 def MakeRunCode(self):
> >                     self.eSaveCode =3D self.eCode
> >
> >             dlg =3D RunDialog(None, "print \"it worked!\"")
> >             dlg.ShowModal()
> >             dlg.Destroy()|
> >
> >
> > The first part is what I need a bit of help with.
> > The pyshl object is supposed to be a python interpreter that comes up
> > on the dialog. The only problem is... I don't get any errors showing
> > that I've done anything wrong. It would be great if someone showed me
> > what I'm doing wrong. I hope that the code snippet I posted works. But
> > anyway, I just need to know what I'm doing wrong. I would be VERY
> > grateful if anyone could help me with this ASAP.
> >
> > Thanks!!!
> >
>
> This code does not run for multiple reasons. There's no wx.App or
> wx.PySimpleApp objects and the global name "py" is not defined. I
> recommend looking at how the Demo does it. It shows how to embed both
> PyShell and PyCrust.
>
> Mike
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wxpython-users/attachments/200803=
20/32fd3d51/attachment.htm


More information about the wxpython-users mailing list