[pygtk] [solved] Change background color?
Sylvain Saleur
syeric1 at gmail.com
Mon Jul 2 11:43:08 WST 2007
Hi!
Thank you very much it works well!
I have to change my glasses because I haven't seen this on this great FAQ...
Cheers
Sylvain
2007/6/27, Seltzer <squabbit7 at gmail.com>:
>
> that works for most windows, as does modify_bg(...),
> but ...
>
> """
> modify_bg() only affects widgets that have an associated gtk.gdk.Window.
> Widgets that do not have an associated window include .... gtk.Arrow,
> gtk.Bin, gtk.Box, gtk.Button, gtk.CheckButton, gtk.Fixed , gtk.Image ,
> gtk.Label , gtk.MenuItem , gtk.Notebook , gtk.Paned , gtk.RadioButton ,
> gtk.Range , gtk.ScrolledWindow , gtk.Separator , gtk.Table , gtk.Toolbar ,
> gtk.AspectFrame , gtk.Frame , gtk.VBox , gtk.HBox , gtk.VSeparator ,
> gtk.HSeparator . These widgets can be added to a gtk.EventBox to overcome
> this limitation.
> """
> (from pygtk reference manual)
>
>
> so use an event box like it says... :)
> and try something like this:
> import gtk
> window = gtk.Window(gtk.WINDOW_TOPLEVEL
> )
> window.connect("destroy", gtk.mainquit)
> label = gtk.Label("one, two, testing...")
> eb = gtk.EventBox()
> eb.add(label)
> eb.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse("blue"))
>
> window.add(eb)
> window.show_all()
> gtk.main()
> (NOTE: this code was lifted from
> http://eccentric.cx/misc/pygtk/pygtkfaq.html )
>
> also check out the gtk.Widget section of the reference manual
> and the gtk.gdk.color_parse one as well.
>
> http://www.pygtk.org/docs/pygtk/
>
> i think that you can also use gtk.gdk.Color (...)
> if you need custom colors...
>
> hope this helps
>
> felix
>
>
> On 6/27/07, Sylvain Saleur <syeric1 at gmail.com > wrote:
> >
> > Hello!
> >
> > Thank you very much, I didn't know this FAQ...
> >
> > So I tried this:
> http://faq.pygtk.org/index.py?req=show&file=faq04.006.htp
> >
> > But it doesn't work! I'm probably use the wrong way...
> >
> > If I apply this method to my notebook, it works. But I just want to
> > set this background to one page childs. And I can't manage to do
> > that...
> >
> > The structure is : Notebook page => Frame => HBox => ScrolledWindow =>
> > VBox => Label, image and Button.
> >
> > I'm sorry if my question has been answered many times but I'm a
> > beginner with pygtk and also not a good english speaker...
> >
> > Cheers
> >
> > Sylvain
> >
> > 2007/6/27, John Dennis < jdennis at redhat.com>:
> > > On Tue, 2007-06-26 at 22:55 -0400, Sylvain Saleur wrote:
> > > > Hello!
> > > >
> > > > I'm trying to change the background color of a part of my program.
> > > > I would like the background in white but I don't know how to do it...
> > > >
> > > > If you have any suggestion...
> > >
> > > The FAQ is your friend :-) It tells you the answer to this question and
> > > many others.
> > >
> > > By the way it's listed at the bottom of every message on this list.
> > >
> > > > Read the PyGTK FAQ:
> http://www.async.com.br/faq/pygtk/
> > >
> > > --
> > > John Dennis <jdennis at redhat.com>
> > >
> > >
> > _______________________________________________
> > pygtk mailing list pygtk at daa.com.au
> > http://www.daa.com.au/mailman/listinfo/pygtk
> > Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
> >
>
>
More information about the pygtk
mailing list