List Info

Thread: Fixed color background




Fixed color background
user name
2006-02-22 21:26:40
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 <Cameronphaseit.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 <Cameronphaseit.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.
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discusspython.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
Fixed color background
user name
2006-02-23 09:56:38
> 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 <Cameronphaseit.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
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discusspython.org
http://mail.python.org/mailman/listinfo/tkinter-discuss
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )