[Idle-dev] Im in desperate need of help with IDLE and wxWidgets

Tal Einat taleinat at gmail.com
Mon Apr 14 10:32:31 CEST 2008


James Duffy wrote:
>
> Ok, my issue is this. Overall I need to make a program that spawns a GUI
> with two list boxes. It will receive an XML file with variables and their
> data, parse it, and store these variables. It stores the names in one array
> and their values in another. The program will then set the contents of the
> list boxes to these arrays, thus creating a constantly updating display of
> variables and values. I have the parser and storage working, but when I
> introduce a GUI into the mix things go awry. I made a simple GUI using
> wxGlade. I run the script it generates and I get the GUI window. However it
> freezes IDLE and I can't enter any commands into it(IDLE) as I need to do
> this to call my xmlRead function to start the parse. When I close the GUI
> window, IDLE crashes. Sometimes when I run the GUI script, it crashes out
> right. Right now I'm very lost as I'm really a rookie with Linux and have
> just this year learned the basics of Python. I really need some help
> figuring out how to get this stuff to run smoothly. FYI I'm running Ubuntu
> 7.10. Let me know if u need any specifics but keep in mind I'm a little
> "Linux challenged" so I really appreciate it if u can take the time to give
> me a dumbed down explanation of what I might do to fix things. I will be
> willing to try an entirely alternate design. My goal is simply getting these
> arrays up on a screen(but not using IDLE to do it).

Hi James, welcome to the IDLE list :)

Congratulations on your move to Linux! Do note that all of the tools
you are using - Python, IDLE, wxPython - are all cross-platform. Both
your work environment and the program you are writing should work just
the same on Windows, OSX, and most UNIX/Linux flavors.

The major problem here is that using IDLE along with wxPython is
problematic. The problem is that IDLE uses a different GUI library -
Tkinter (which is Tcl/Tk wrapped for Python). Tkinter and wxPython
don't play along nicely at all, one of the reasons being that each
uses its own event loop.

My advice here is not to use IDLE's shell to run or test your
application - run your app directly from the shell. (Editing the code
from IDLE won't give you any trouble, of course.) If you really want
to use a more feature-rich Python interpreter than the command-line
interpreter, instead of IDLE's shell try IPython or PyCrust, which
integrate nicely with wxPython. (IPython needs to be configured
appropriately for this, PyCrust works out of the box.)

You could also try asking the guys on the wxPython users list
(wxpython-users /AT/ lists.wxwidgets.org) who are more experienced
with this type of issue and will be glad to help you out.

Good luck!
- Tal


More information about the IDLE-dev mailing list