I don't think you should mix pylab with matplotlib object API 
programming (or even the Tkinter event loop), though it may be safe if 
you are just displaying a plot in a standalone window. It takes a bit 
more work, but the object API lets you mix matplotlib plots freely with 
other Tkinter elements. maplotlib comes with good examples for using the 
object API with Tkinter.

If you decide it is safe to use pylab (instead of matplotlib's object 
API) then at least import pylab using:

import pylab

instead of

from pylab import *

to avoid namespace pollution. Using "from <foo> import *" is almost 
never a good idea and pylab is an especially large package. "from pylab 
import *" can be handy for creating graphs on the fly, but it was never 
intended for coding into scripts.

-- Russell

In article 
<aanlktinhgq29pmgj6df2csul5lyce_d5i7_edznms...@mail.gmail.com>,
 Alex Ter-Sarkissov <sigma.z.1...@gmail.com> wrote:

> hi, the problem might be bit silly...
> 
> I'm desiging a GUI with Tkinter. Everythin worked (just couple buttons and
> entries). Then I decided I need to import pylab:
> 
> from pylab import *
> 
> as a result, I'm getting an error message
> 
> TypeError: __init__() got an unexpected keyword argument 'text'
> 
> which refers to the command line in def __init__(self)
> 
> self.start_but=Button(root,text='Generate starting population')
> 
> Like I said earlier, if I do not import pylab/matplotlib, no error messages
> are received.
> 
> cheers,
> 
> Alex
> ---------------------------------------------------------------------
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss@python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss

_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to