Pellegrini Eric wrote:
> Hello everybody,
>
> I use wxpython 2.8.12.1 altogether with matplotlib backend (1.1.1rc) on
> an ubuntu machine (12.04). I would like to connect my matplotlib canvas
> to a button_press_event that pops up a wxpython message dialog (modal).
> When the modal dialog pops up, the whole application gets frozen BUT
> also the message dialog on which I do not have any control anymore AND
> the desktop on which the application is currently running. The only way
> to escape from this, is to switch desktop using keyboard and come back
> to the one that contains the application. This problem does not occur on
> a windows machine. Here is a code snippet that typically reproduces the
> problem.
I don't know if this is the same issue but one thing I ran into when
using MPL is that if certain modules get imported before there is an app
object then it will create its own, and if the default backend is set to
something other than wx then it could be importing and creating an app
object for some other gui toolkit and that could be what is messing up
the dialog's modal event loop.
Matplotlib has a mechanism for selecting which back-end should be used,
and with some careful importing you can ensure that it doesn't create
its own wx.App instance. I dealt with that simply by having my wx.App
and main frame classes in a module that does not import any matplotlib
modules. Once the app and the frame were created then I imported the
module that implemented my plot canvas classes and then matplotlib was
imported from there.
--
Robin Dunn
Software Craftsman
http://wxPython.org