Re: [Sugar-devel] Background Screen Color for SoaS Activity
On Tue, Jul 14, 2009 at 04:21, Art Hunkinsabhun...@uncg.edu wrote: Gary - Thanks so much for these helpful suggestions. At this point, I think it would be more efficient if you went through the PyGTK tutorial. No need to do all of it, though. http://www.pygtk.org/pygtk2tutorial/index.html What is easy to do in some widget systems isn't as easy in others, unfortunately. Regards, Tomeu With them I've been able to change the color of the basic Sugar display, and to create boxes of differing colors. Several major issues remain (which may not be surmountable?): 1) when text displayed on the basic screen (in no box) - that area reverts to gray; 2) importantly, nothing else displays in my colored boxes; this includes frames, other boxes, text and buttons. Can you guide me toward solutions here? I'm basically modifying Lazzarini's csndsugui.py. Here is the revised box code: def box(self, vert=True, colour=(0x, 0x, 0x), parent=None, padding=5): creates a box vert: True, creates a vertical box; horiz. otherwise parent: parent box, None if this is a toplevel box padding: box padding returns the widget instance if vert: box = gtk.VBox() else: box = gtk.HBox() self.event_box = gtk.EventBox() self.event_box.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(colour[0], colour[1], colour[2], 0)) if parent: parent.pack_start(self.event_box) else: self.outbox.pack_start(self.event_box) self.window.set_canvas(self.outbox) self.boxes.append(box) self.event_box.show() box.show() return box I suspect that chaages in the last few lines are required (especially in the boxes line and probably the packing). And here is the current text code. I rather imagine if this could be gotten to display in a box with the box retaining its color, I might be on the way to success (but this may be the hard part; can other things be displayed over an event_box?). This code is straight from Lazzarini: def text(self, name, box=None,colour=(0,0,0)): Creates a static text label name: text label box: parent box, None if text is to be placed toplevel colour: RGB values in a tuple (R,G,B) returns the widget instance label = gtk.Label(name) label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.Color(colour[0],colour[1],colour[2], 0)) if box: box.pack_start(label, False, False, 5) else: self.outbox.pack_start(label, False, False, 5) label.show() return label I very much appreciate your help. I, too, wonder if all this hassling over color is worth it. If only there were some simple way to make the overall display white instead of gray! I'm wanting the color change strictly for readability; I need more color contrast to read the text (which is unfortunately profuse in my project). Art Hunkins - Original Message - From: Gary C Martin g...@garycmartin.com To: Art Hunkins abhun...@uncg.edu Cc: Tomeu Vizoso to...@sugarlabs.org; sugar-devel@lists.sugarlabs.org Sent: Tuesday, July 07, 2009 10:07 AM Subject: Re: [Sugar-devel] Background Screen Color for SoaS Activity 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 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] Background Screen Color for SoaS Activity
On Wed, Jul 15, 2009 at 12:46, Tomeu Vizosoto...@sugarlabs.org wrote: On Tue, Jul 14, 2009 at 04:21, Art Hunkinsabhun...@uncg.edu wrote: Gary - Thanks so much for these helpful suggestions. At this point, I think it would be more efficient if you went through the PyGTK tutorial. No need to do all of it, though. http://www.pygtk.org/pygtk2tutorial/index.html What is easy to do in some widget systems isn't as easy in others, unfortunately. Forgot to mention the PyGTK FAQ, which has several entries related about changing background colors: http://faq.pygtk.org/index.py?req=index I don't think any of the issues you are referring to are specific to Sugar, so you can use the upstream documentation without fear of missing any details. HTH, Tomeu Regards, Tomeu With them I've been able to change the color of the basic Sugar display, and to create boxes of differing colors. Several major issues remain (which may not be surmountable?): 1) when text displayed on the basic screen (in no box) - that area reverts to gray; 2) importantly, nothing else displays in my colored boxes; this includes frames, other boxes, text and buttons. Can you guide me toward solutions here? I'm basically modifying Lazzarini's csndsugui.py. Here is the revised box code: def box(self, vert=True, colour=(0x, 0x, 0x), parent=None, padding=5): creates a box vert: True, creates a vertical box; horiz. otherwise parent: parent box, None if this is a toplevel box padding: box padding returns the widget instance if vert: box = gtk.VBox() else: box = gtk.HBox() self.event_box = gtk.EventBox() self.event_box.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(colour[0], colour[1], colour[2], 0)) if parent: parent.pack_start(self.event_box) else: self.outbox.pack_start(self.event_box) self.window.set_canvas(self.outbox) self.boxes.append(box) self.event_box.show() box.show() return box I suspect that chaages in the last few lines are required (especially in the boxes line and probably the packing). And here is the current text code. I rather imagine if this could be gotten to display in a box with the box retaining its color, I might be on the way to success (but this may be the hard part; can other things be displayed over an event_box?). This code is straight from Lazzarini: def text(self, name, box=None,colour=(0,0,0)): Creates a static text label name: text label box: parent box, None if text is to be placed toplevel colour: RGB values in a tuple (R,G,B) returns the widget instance label = gtk.Label(name) label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.Color(colour[0],colour[1],colour[2], 0)) if box: box.pack_start(label, False, False, 5) else: self.outbox.pack_start(label, False, False, 5) label.show() return label I very much appreciate your help. I, too, wonder if all this hassling over color is worth it. If only there were some simple way to make the overall display white instead of gray! I'm wanting the color change strictly for readability; I need more color contrast to read the text (which is unfortunately profuse in my project). Art Hunkins - Original Message - From: Gary C Martin g...@garycmartin.com To: Art Hunkins abhun...@uncg.edu Cc: Tomeu Vizoso to...@sugarlabs.org; sugar-devel@lists.sugarlabs.org Sent: Tuesday, July 07, 2009 10:07 AM Subject: Re: [Sugar-devel] Background Screen Color for SoaS Activity 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 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] Background Screen Color for SoaS Activity
Gary - Thanks so much for these helpful suggestions. With them I've been able to change the color of the basic Sugar display, and to create boxes of differing colors. Several major issues remain (which may not be surmountable?): 1) when text displayed on the basic screen (in no box) - that area reverts to gray; 2) importantly, nothing else displays in my colored boxes; this includes frames, other boxes, text and buttons. Can you guide me toward solutions here? I'm basically modifying Lazzarini's csndsugui.py. Here is the revised box code: def box(self, vert=True, colour=(0x, 0x, 0x), parent=None, padding=5): creates a box vert: True, creates a vertical box; horiz. otherwise parent: parent box, None if this is a toplevel box padding: box padding returns the widget instance if vert: box = gtk.VBox() else: box = gtk.HBox() self.event_box = gtk.EventBox() self.event_box.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(colour[0], colour[1], colour[2], 0)) if parent: parent.pack_start(self.event_box) else: self.outbox.pack_start(self.event_box) self.window.set_canvas(self.outbox) self.boxes.append(box) self.event_box.show() box.show() return box I suspect that chaages in the last few lines are required (especially in the boxes line and probably the packing). And here is the current text code. I rather imagine if this could be gotten to display in a box with the box retaining its color, I might be on the way to success (but this may be the hard part; can other things be displayed over an event_box?). This code is straight from Lazzarini: def text(self, name, box=None,colour=(0,0,0)): Creates a static text label name: text label box: parent box, None if text is to be placed toplevel colour: RGB values in a tuple (R,G,B) returns the widget instance label = gtk.Label(name) label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.Color(colour[0],colour[1],colour[2], 0)) if box: box.pack_start(label, False, False, 5) else: self.outbox.pack_start(label, False, False, 5) label.show() return label I very much appreciate your help. I, too, wonder if all this hassling over color is worth it. If only there were some simple way to make the overall display white instead of gray! I'm wanting the color change strictly for readability; I need more color contrast to read the text (which is unfortunately profuse in my project). Art Hunkins - Original Message - From: Gary C Martin g...@garycmartin.com To: Art Hunkins abhun...@uncg.edu Cc: Tomeu Vizoso to...@sugarlabs.org; sugar-devel@lists.sugarlabs.org Sent: Tuesday, July 07, 2009 10:07 AM Subject: Re: [Sugar-devel] Background Screen Color for SoaS Activity 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 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] Background Screen Color for SoaS Activity
On Tue, Jul 7, 2009 at 04:46, Art Hunkinsabhun...@uncg.edu 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 have done it routinely, can you share the whole code of your activity class? Regards, Tomeu Art Hunkins - Original Message - From: Tomeu Vizoso to...@sugarlabs.org To: Art Hunkins abhun...@uncg.edu Cc: sugar-devel@lists.sugarlabs.org Sent: Monday, July 06, 2009 4:26 AM Subject: Re: [Sugar-devel] Background Screen Color for SoaS Activity On Mon, Jul 6, 2009 at 06:19, Art Hunkinsabhun...@uncg.edu wrote: The default color for the Sugar Activity screen seems to be set to light gray. I'd like mine to be white. Is there any way to change this in my activity script? That looks good to me, perhaps ibox contains some other widget that is covering it completely? Regards, Tomeu I tried: import gtk win = csndsugui.CsoundGUI(self) ibox = win.box(False) ibox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(0x, 0x, 0x)) where ibox = the entire screen. However this changed nothing. Anything fairly straightforward I could try? Art Hunkins ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] Background Screen Color for SoaS Activity
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 ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] Background Screen Color for SoaS Activity
Tomeu and Gary, Thanks for your advice and interest. I've attached my complete activity (OurMusic) in the form of an .xo archive. Note that it requires csndsugui.py (included), Victor Lazzarini's Csound GUI toolkit. It's barely possible that the color issue lies therein (but unlikely). The background color issue is the only issue when the activity is run on OLPC; on SoaS, there is another as well: an unavailable csnd or _csnd module (from python 2.6). For the latter issue, Aleksey suggested a Scons-related fix (that I've yet to be able to implement, unfortunately, as my technical expertise is *highly* limited). If you manage to get an initial display on a white background, I'd be most grateful. If you do have/get a display, probably options 2 and 4 will work for you; they use only the ASCII keyboard, no MIDI controllers (unlike 1 and 3). I'd be delighted if these worked on SoaS. Gary, I'll be trying your code as well. I presume it should go near the beginning in my main loop? (Sorry, my grasp of both python and GTK -- OOP for that matter -- is so minimal.) Art Hunkins - Original Message - From: Tomeu Vizoso to...@sugarlabs.org To: Art Hunkins abhun...@uncg.edu Cc: sugar-devel@lists.sugarlabs.org Sent: Tuesday, July 07, 2009 4:55 AM Subject: Re: [Sugar-devel] Background Screen Color for SoaS Activity On Tue, Jul 7, 2009 at 04:46, Art Hunkinsabhun...@uncg.edu 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 have done it routinely, can you share the whole code of your activity class? Regards, Tomeu Art Hunkins - Original Message - From: Tomeu Vizoso to...@sugarlabs.org To: Art Hunkins abhun...@uncg.edu Cc: sugar-devel@lists.sugarlabs.org Sent: Monday, July 06, 2009 4:26 AM Subject: Re: [Sugar-devel] Background Screen Color for SoaS Activity On Mon, Jul 6, 2009 at 06:19, Art Hunkinsabhun...@uncg.edu wrote: The default color for the Sugar Activity screen seems to be set to light gray. I'd like mine to be white. Is there any way to change this in my activity script? That looks good to me, perhaps ibox contains some other widget that is covering it completely? Regards, Tomeu I tried: import gtk win = csndsugui.CsoundGUI(self) ibox = win.box(False) ibox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(0x, 0x, 0x)) where ibox = the entire screen. However this changed nothing. Anything fairly straightforward I could try? Art Hunkins ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel OurMusic-1.xo Description: Binary data ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] Background Screen Color for SoaS Activity
On Mon, Jul 6, 2009 at 06:19, Art Hunkinsabhun...@uncg.edu wrote: The default color for the Sugar Activity screen seems to be set to light gray. I'd like mine to be white. Is there any way to change this in my activity script? That looks good to me, perhaps ibox contains some other widget that is covering it completely? Regards, Tomeu I tried: import gtk win = csndsugui.CsoundGUI(self) ibox = win.box(False) ibox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(0x, 0x, 0x)) where ibox = the entire screen. However this changed nothing. Anything fairly straightforward I could try? Art Hunkins ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
Re: [Sugar-devel] Background Screen Color for SoaS Activity
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? Art Hunkins - Original Message - From: Tomeu Vizoso to...@sugarlabs.org To: Art Hunkins abhun...@uncg.edu Cc: sugar-devel@lists.sugarlabs.org Sent: Monday, July 06, 2009 4:26 AM Subject: Re: [Sugar-devel] Background Screen Color for SoaS Activity On Mon, Jul 6, 2009 at 06:19, Art Hunkinsabhun...@uncg.edu wrote: The default color for the Sugar Activity screen seems to be set to light gray. I'd like mine to be white. Is there any way to change this in my activity script? That looks good to me, perhaps ibox contains some other widget that is covering it completely? Regards, Tomeu I tried: import gtk win = csndsugui.CsoundGUI(self) ibox = win.box(False) ibox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(0x, 0x, 0x)) where ibox = the entire screen. However this changed nothing. Anything fairly straightforward I could try? Art Hunkins ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel
[Sugar-devel] Background Screen Color for SoaS Activity
The default color for the Sugar Activity screen seems to be set to light gray. I'd like mine to be white. Is there any way to change this in my activity script? I tried: import gtk win = csndsugui.CsoundGUI(self) ibox = win.box(False) ibox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.Color(0x, 0x, 0x)) where ibox = the entire screen. However this changed nothing. Anything fairly straightforward I could try? Art Hunkins ___ Sugar-devel mailing list Sugar-devel@lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/sugar-devel