|
From: John M. <mcf...@gm...> - 2013-08-06 21:03:57
|
On 8/6/2013 3:31 PM, Eric Firing [via matplotlib] wrote:
> Before the *first* import of pyplot, you need to have:
>
> import matplotlib
> matplotlib.use("agg")
>
> or specify any other non-interactive backend. Alternatively, you can
> specify the backend in a matplotlibrc file.
>
> This assumes you don't actually need an interactive backend. If you do
> need it, then I suspect you will need to change the strategy you are
> using in your program, ideally eliminating the input thread. You might
> use a gtk idle event callback to handle the user input, for example.
> The problem here is that python threads and gui toolkits tend not to mix
> well.
>
> I suspect that raw_input is using the PyOS_InputHook, which is also
> being used by gtk, so you are violating the prohibition against
> gui-related activities being in more than one thread.
>
> Eric
Thanks Eric, that did work for me. I don't necessarily need an
interactive backend for this, but it could be nice to get it to work. I
just tried switching raw_input to sys.stdin.readline, and that seems to
work even with the interactive backend.
John
--
View this message in context: http://matplotlib.1069221.n5.nabble.com/Importing-pyplot-blocks-input-thread-tp41731p41733.html
Sent from the matplotlib - users mailing list archive at Nabble.com. |