[Sugar-devel] Background Screen Color for SoaS Activity
Gary C Martin
gary at garycmartin.com
Tue Jul 7 10:07:09 EDT 2009
Hi Art,
On 7 Jul 2009, at 03:46, Art Hunkins wrote:
> Tomeu,
>
> I've had no luck modifying background color for anything except
> buttons.
>
> No boxes, even when the box is completely empty.
>
> Does anyone know how to change the color of the entire screen, or of
> a box?
I can remember hitting my head on this when first playing with gtk. I
wanted a black area to place a moon image in. The trick seems to be
using a gtk.EventBox(). Have a look in moon.py at about line #114:
http://git.sugarlabs.org/projects/moon/repos/mainline/trees/master
Just quickly scraped out the lines I think might be interesting, does
seem quite a bit for just a black screen :-)
# Create the main activity container
self.main_view = gtk.HBox()
# Blackness
self.event_box = gtk.EventBox()
colormap = gtk.gdk.colormap_get_system()
self.black_alloc_color = colormap.alloc_color('black')
self.event_box.modify_bg(gtk.STATE_NORMAL, self.black_alloc_color)
self.main_view.pack_end(self.event_box)
# Display everything
self.event_box.show()
self.main_view.show()
self.set_canvas(self.main_view)
self.show_all()
Regards,
--Gary
More information about the Sugar-devel
mailing list