From: Stephen W. <st...@ke...> - 2004-04-11 21:22:35
|
Jonatan Liljedahl <th...@ho...> wrote: > When making applets (with python), it would be nice to be able to set > the applet-window background to the same that the panel has. Is there a > simple way to do this, or do I have to read it myself from the gtk-rc > settings? > > something like this would be nice: > > w = Applet(sys.argv[0]) > w.set_bg_color(w.get_parent().get_bg_color()) > > ..but I guess it couldn't be as simple as that... From NetStat/gui.py def expose(widget, event): (x, y, width, height)=widget.get_allocation() style=widget.get_style() gc=style.bg_gc[g.STATE_NORMAL] try: area=None style.apply_default_background(widget.window, g.TRUE, g.STATE_NORMAL, area, 0, 0, width, height) except: widget.window.draw_rectangle(gc, 1, 0, 0, width, height) The try: block is because some versions of pygtk fail in apply_default_background() -- Stephen Watson http://www.kerofin.demon.co.uk/ If you read this on a mailing list, send any reply back to the list and not to me. |