Closed ThatGeoGuy closed 9 years ago
Thanks for testing the prompt with mathplotlib!
I guess this is caused by that we integrate with IPython by overriding InteractiveShellEmbed
. This works, but has some limitations. If we connect through zmq with an IPython kernel, it should work a lot better. (That's how I understand it.)
cc: @Carreau Would that be the solution? If you have any pointers for me how to properly integrate with IPython, that's very welcome. (For me personally not urgent, because I have some other issues to resolve first.)
Ouh, segfault is nasty.
%pylab can take an evenloop option tk,qt, gtk... (see %gui?) to avoid the blocking problem. With a quick look it seem like ptipython also have it's own eventloop, so I suppose the 2 interfere. I'm not familar with the evenloop code.
I would look into IPython.lib.inputhook for how it can be integrated with qt/wx and other, but that will probably be a lot of code or refactor of the eventloop here and in IPython.
prompt-toolkit has indeed its own event loop: https://github.com/jonathanslenders/python-prompt-toolkit/tree/master/prompt_toolkit/eventloop It's a very simple one, used to receive information from other threads while reading input from stdin. For the rest of the code is should be nothing different from a simple blocking read()
I will have a look at ipython.lib.inputhook
. It should be possible to use that loop instead.
Thank you!
Hi, thanks for python-prompt-toolkit! Any luck with this issue?
No, not yet. I had a look at the event loops of IPython, but I remember there was no way to plug my own code in there. I guess this needs changes on both IPython and prompt-toolkit. (prompt-toolkit needs an event loop that supports run_in_executor and call_from_executor as well as monitoring for stdin.)
Currently I'm busy working on the refactoring of the layout system. But maybe I'll have a second look later on.
gotcha, sounds like a headache. thanks!
On Fri, Jan 9, 2015 at 11:15 AM, Jonathan Slenders <notifications@github.com
wrote:
No, not yet. I had a look at the event loops of IPython, but I remember there was no way to plug my own code in there. I guess this needs changes on both IPython and prompt-toolkit. (prompt-toolkit needs an event loop that supports run_in_executor and call_from_executor as well as monitoring for stdin.)
Currently I'm busy working on the refactoring of the layout system. But maybe I'll have a second look later on.
— Reply to this email directly or view it on GitHub https://github.com/jonathanslenders/python-prompt-toolkit/issues/63#issuecomment-69356172 .
Hi everyone,
ptpython now integrates automatically with the tk eventloop when it detects that the tkinter
package was imported. So, the turtle
package and other tk stuff should work again.
This also means that ptipython
will display plots correctly when the TkAgg
matplotlib backend is used. (That's the default, I think.)
For a better integration with IPython, I refer to this ticket: https://github.com/ipython/ipython/issues/8489
Jonathan
Hey @jonathanslenders, thanks for looking into this. I'm impressed and amazed that my bug report has come this far.
Thanks again for the work you've done on this until now. I've begun playing around with ptipython again, and it's much more polished. I'm excited to see future integrations with IPython, so thanks again for your work!
You're welcome!
This is using python3.4.1, on Windows 7 Professional 64 bit, with the latest IPython, as well as numpy / scipy / matplotlib.
I was just playing around with the experimental windows support, just to test out the features (like autocompletion, ipython integration, etc). Anyways, the first thing I usually do is try out matplotlib, to see if it's working / loading correctly.
This should, ideally, plot a single figure window with the line x = y in it. It draws the window, but the plot inside cannot be seen. What's more, if you try to interact with the window in any way, it crashes the python instance.
So I figured I'd try the same thing by pasting the relevant matplotlib code directly from python.
This works, but there is a drawback, ptpython (and of course, ptipython) both plot the figure, but do not return the prompt until the window with the plot is closed. This is somewhat of a serious flaw, as it requires you can't use plots / data visualization interactively.
Unfortunately, I have not really narrowed down the factors as to why these bugs are apparent. I had initially thought it had something to do with ipython, but running the code listed in
test.py
in ptpython exhibits the same behaviour. However, there does appear to be some issue using%pylab
and its associated functions (calling plot directly) in ptipython. In any case, I'll check when I get home and have access to a Linux machine to see if this behaviour is replicable there as well.