[Tkinter-discuss] problem with pylab/tkinter?

Michael O'Donnell michael.odonnell at uam.es
Sun Oct 24 11:03:14 CEST 2010


Hi Alex,

  I don't use pylab, but I would suggest that pylab has a class Button.
You are trying to use the tkinter Button.

Possible solutions:

a) Move you "from tkinter import *" AFTER the pylab import,
and possibly this will mean the tkinter Button class will be accessed first.

b) Better: don't import the entire pylab module, do:

from pylab import myfunct1, myfunct2

(...where myfunct1, myfunct2 are the functions or classes  you want to import)

c) even better:

import tkinter
self.start_but=tkinter.Button(root,text='Generate starting population')

Mick

On Sun, Oct 24, 2010 at 10:10 AM, Alex Ter-Sarkissov
<sigma.z.1980 at 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 at python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
>
>


More information about the Tkinter-discuss mailing list