[Tkinter-discuss] Fixed color background

Cameron Laird Cameron at Phaseit.net
Wed Feb 22 22:26:40 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()
> > >
> > > Above is the start of my program, I use a class to keep it clean and
> > easier
> > > for me to work with. Any way, I don't see anywhere where I can apply
> > your
> > > answer.
> > >
> > > On 2/22/06, Cameron Laird <Cameron at phaseit.net> wrote:
> > > >
> > > > On Tue, Feb 21, 2006 at 07:24:38PM -0800, this_is Not_my_name wrote:
> > > >                         .
> > > >                         .
> > > >                         .
> > > > > How do I set the background color of a frame to black?
> > > >                         .
> > > >                         .
> > > >                         .
> > > >   >>> import Tkinter
> > > >   >>> f = Tkinter.Frame(width = 50, height = 50, background = "black")
> > > >   >>> f.pack()
> > > >
> > > > is an example.
> > > >
> >
> > It's hard for me, too, to apply my answer to the different question
> > you haven't yet made explicit.  Do you want to change the background
> > color of all instances of Application to black?  Only one?  Pick a
> > fight about whether your definition succeeds in "keep[ing] it clean
> > and easier ..."?  In any case, I invite you to replace
> >   Frame.__init__(self, master)
> > with
> >   Frame.__init__(self, master, background = "black")
> > to determine whether that brings you any closer to where you want to
> > be.
> >
> > There's also a completely different approach to this sort of configu-
> > ration through the "option database".  I have no idea whether I should
> > recommend you pursue that direction.
> >
> > I urge you to carry on this conversation in the mailing list; to do so
> > gives others a chance to help.
> >

The messages arriving at me appear NOT to be passing through the 
mailing list.  I've redirected follow-ups back there, on the as-
sumption that's your intention.

I don't know what more to say; when I run applications with
  Frame.__init__(self, master, background = "black")
I see a black background, not a TypeError.  Perhaps someone else
recognizes what's going on.


More information about the Tkinter-discuss mailing list