[IPython-dev] Re: [SciPy-dev] Generic gui_thread + IPython: solution already exists!

John Hunter jdhunter at ace.bsd.uchicago.edu
Mon Nov 15 12:27:51 EST 2004


>>>>> "Prabhu" == Prabhu Ramachandran <prabhu_r at users.sf.net> writes:

>>>>> "JH" == John Hunter <jdhunter at ace.bsd.uchicago.edu> writes:
>>>>> "Prabhu" == Prabhu Ramachandran <prabhu_r at users.sf.net> writes:
    JH> Oops, sorry, I'm lame.

    JH> This happens in --gthread and --wthread and so doesn't appear
    JH> to be matplotlib related; but for the record I'm using cvs
    JH> matplotlib.

    Prabhu> Hmm, I did not know that --gthread also worked, I thought
    Prabhu> only -gthread and -wthread worked.  The gthread option is
    Prabhu> really not doing anything fancy at all.  All I've added is
    Prabhu> a function that updates Tkinter when the timer is called
    Prabhu> and removed gtk's own mainloop with a hijacked version.

The test is

        if arg1.endswith('-gthread'):

so either -gthread or --gthread works.

Hmm.  I'm not experiencing any problems with iptyhon 0.6.4 or cvs
ipython, but with the patched shell I'm getting very frequent freezes

I spent a lot of time commenting out various parts of your patch to
figure out what is causing the problems, and it appears to be 

def update_tk(tk):
    """Updates the Tkinter event loop.  This is typically called from
    the respective WX or GTK mainloops.
    """
    if tk:
        tk.update()

If I simply return on this function rather than doing the update (or
equivalently if I just set self.tk=None) I don't see the freeze.  Some
version info below.

Note I am not otherwise using tk in my environment - could this be a
source of the difference that we are seeing?

    Prabhu> [...]
    JH> FYI, I had to hack hijack_wx because on my wx, there is no
    JH> wx._core_.  It appears to be wx._core.  I don't know if a
    JH> similar hack needs to be applied to the 2.4 section.

    Prabhu> wxPython-2.4 is I think is more reliable and should work
    Prabhu> out fine.  You'll need my updated patch that I just posted
    Prabhu> though (it just changes one line).

I already applied it, thanks.

    Prabhu> To improve the hijacking can you just check these out and
    Prabhu> let me know?  Does wx._core have a _core_ attribute?  If
    Prabhu> so, then you really need to access wx._core._core_ and
    Prabhu> hijack that, this works for me also, so if this works for
    Prabhu> you, I'll make that the default and we won't need any of
    Prabhu> the hasattr checks.

No, I don't have a wx._core._core_ (or anything like it)

3 >>> print [name for name in dir(wx._core) if name.startswith('_c')]
[]

4 >>> print [name for name in dir(wx) if name.startswith('_c')]
['_controls', '_core']




Version info
peds-pc311:~> uname -a
Linux peds-pc311.bsd.uchicago.edu 2.4.21-15.0.2.ELsmp #1 SMP Wed Jun 16 22:52:07 EDT 2004 i686 i686 i386 GNU/Linux

peds-pc311:~> python
Python 2.3.3 (#2, Apr 13 2004, 17:41:29)
[GCC 3.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Tkinter
>>> Tkinter.TkVersion
8.4000000000000004




More information about the IPython-dev mailing list