I want to launch frames to plot graphs from the Idle interpreter prompt.
The example plotting utilties from wxPython/wxWindows (wxPlotCanvas),
and from Scientific Python (TkPlotCanvas)are good starting points (and
they both work fine).

The problem is that once the windowing "app" is put into the event loop,
the interpreter hangs up. In other words, after calling app.MainLoop()
(wxWindows) or window.mainloop() (TkPlotCanvas)you can't continue in the
interpreter until closing the frame or window.

I can work around this by breaking the rules, and putting up frames
without event loops (not calling app.MainLoop or window.mainloop).
Everything works, except that then the frames cannot be closed. The
OnCloseWindow event is still called, but it is apparently queued,
waiting to be 'caught' by an event loop that has not been enabled.

I need to be able to call a function that will pop open the Tkinter or
wxWindow frame, but continue to allow input at the interpreter command
line. What's the proper way to do this?


Search Discussions

  • Jeff Shannon at Mar 25, 2002 at 8:46 pm

    bptonner at yahoo.com wrote:

    I want to launch frames to plot graphs from the Idle interpreter prompt.
    In general, this will not work under IDLE or PythonWin. The problem is that
    having multiple message loops within a single process doesn't work. The
    solution is to run your code in a different process. You can do this by
    either (1) running the script from a shell prompt, and switching back and
    forth between that and your IDE, or (2) switching to an IDE that runs code
    out-of-process. I *believe* that IDLE-Fork (on sourceforge) will do this,
    and most (if not all) of the commercial Python IDEs do as well.

    Jeff Shannon
    Credit International

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
postedMar 24, '02 at 11:38p
activeMar 25, '02 at 8:46p

2 users in discussion

Jeff Shannon: 1 post Bptonner: 1 post



site design / logo © 2023 Grokbase