Wasn't sure where to post this so I'll keep it brief (and I have tried to check forums, FAQ and guides)
I'm a relative noob but have a Tk based GUI running properly and have used Matplotlib successfully in two separate implementations of code. When I try to combine my GUI code with my matplotlib code and then place a "from pylab import *" into my code, I run into problems with the GUI widgets "text" variable "not being expected". This is before I execute any specific features of pylab.
If I move the import down in my code, after the GUI classes I have created have exited their mainloop, I have no problem. It seems as if execution of the pylab import interferes with the Tk widgets "text" keyword somehow. I would prefer to execute my matplotlib "code" iteratively from inside of my gui (as the user picks different data sets and so forth) and not have the program exit my mainloop GUI environment to then plot independently using matplotlib.
The pieces work fine, but it is odd to me that the location of where I place the import determines the success of execution of my code. Perhaps there is some important information about Tk running a mainloop and importing pylab at the same time that I do not understand. (I normally execute from double click on the filename.py)
I can share the code and the rc file but wanted to make sure I was in the right post location first. Apologies if I misunderstood FAQ direction for problem review.
Be a better sports nut! Let your teams follow you
with Yahoo Mobile. Try it now. http://mobile.yahoo.com/sports;_ylt=At9_qDKvtAbMuh1G1SQtBI7ntAcJ
From: John Hunter <jdh2358@gm...> - 2007-11-26 15:02:35
On Nov 24, 2007 8:46 PM, Michael Frauens <wet_colored_arch@...> wrote:
> Wasn't sure where to post this so I'll keep it brief (and I have tried to
> check forums, FAQ and guides)
> I'm a relative noob but have a Tk based GUI running properly and have used
> Matplotlib successfully in two separate implementations of code. When I try
> to combine my GUI code with my matplotlib code and then place a "from pylab
> import *" into my code, I run into problems with the GUI widgets "text"
> variable "not being expected". This is before I execute any specific
> features of pylab.
Short answer: you cannot use pylab in a GUI. Rather, you have to use
the matplotlib API (see http://matplotlib.sourceforge.net/faq.html#OO
). There are some examples to get you started, eg
Hope this helps,