[Tkinter-discuss] Fixed color background

Michael Lange klappnase at web.de
Thu Feb 23 10:56:38 CET 2006


> On Wed, Feb 22, 2006 at 01:15:43PM -0800, this_is Not_my_name wrote:
> 			.
> 			.
> 			.
> > When I follow the suggestion, I get a type error...
> > 
> > TypeError: __init__() got an unexpected keyword argument 'background'
> > 
> > I haven't had this problem before, all of the programs I make that include a
> > GUI, i've used this method. Usually with a little perserverance I can get it
> > working. But this one has me stuck. Anybody else have any suggestions?
> > 
> > On 2/22/06, Cameron Laird <Cameron at phaseit.net> wrote:
> > >
> > > On Wed, Feb 22, 2006 at 12:37:25PM -0800, this_is Not_my_name wrote:
> > >                         .
> > >                         .
> > >                         .
> > > > from Tkinter import *
> > > > import tkMessageBox, smtplib, string, webbrowser
> > > > class Application(Frame):
> > > >     def __init__(self, master):
> > > >         Frame.__init__(self, master)
> > > >         self.grid()
> > > >         self.create_widgets()
> > > >

Just a guess: maybe somewhere in your code you did something like:

    app = Application(master, background='black')
?

To avoid problems like this I usually set up the constructor of widget subclasses to pass
any keyword to the parent class, like:

    class Application(Frame):
        def __init__(self, master, **kw):
            Frame.__init__(self, master, **kw)

If this is not the problem, please show more of the code and a complete traceback.

I hope this helps

Michael


More information about the Tkinter-discuss mailing list