bob.sacamento
bob.sacamento

Reputation: 6661

Why is my wx.App interfering with my matplotlib plots?

I am trying to build a GUI with wxPython to control a pretty stable, well-established model. The standard output of the model includes a series of plots to screen done via matplotlib. These plots are all OK if the model is run from the command line. If I run from my new GUI, however, they all show up, but I have no control over them: I can't click their respective "save" buttons; if they get covered up by other windows, they are "grayed out" when the blocking window is moved away. Things like that. If I close my GUI window, however, I get full control of my plots again. But this is no way to run this code.

I think my procedure is pretty standard. The bare outlines of the code are:

import wx
import model_code

class gui_for_model(wx.Frame):
    # lots of stuff with hooks into model_code,
    # including a "go" button that starts model_code running

#end of class

app=wx.App(False)
gm = gui_for_model()
app.MainLoop()

Anyone know what I should do differently? Thanks.

Upvotes: 0

Views: 137

Answers (1)

Yoriz
Yoriz

Reputation: 3625

Here is a link to a site that has some demo code of using matplotlib with wxPython GUIs. eli.thegreenplace.net/2008/08/01/matplotlib-with-wxpython-guis

Also this - matplotlib.org/faq/usage_faq.html talks about changing the backend.

And i found a package on pypi pypi.python.org/pypi/wxmplot/0.9.12

Upvotes: 3

Related Questions