setting background color on gnomecanvas widget

J

Joe Van Dyk

For now, I'm just putting a colored Gnome::CanvasRect as the
background and resizing it when the canvas gets resized.

Couple more questions:

1) Can someone point me to any programs that use ruby's gnomecanvas?=20
(besides Sokoban and that one Chess Clock one)

2) I'm drawing a bunch of lines on a GnomeCanvas that's supposed to
be a grid. The user can specify the grid spacing (in pixels), and can
also resize the Canvas (so more grid lines need to be drawn). What is
the standard way to redraw all those lines when the user specifies a
different grid spacing frequency or when the user resizes the canvas?=20
Put them all in a CanvasGroup and then delete and recreate all the
lines in that group on every resize and redraw?

Thanks,
Joe
 
M

Martin DeMello

Joe Van Dyk said:
Hi,

How does one set the background color on a gnomecanvas widget?

http://developer.gnome.org/doc/API/2.0/libgnomecanvas/GnomeCanvas.html
makes reference to a bg_color field, but I don't see that referenced
in the source for ruby-gnome2. (and there's no documentation for
gnomecanvas yet apparently)

I recently asked about modifying Gtk widget backgrounds (on the
ruby-gnome mailing list) and was pointed towards Widget#modify_bg(state,
color) and Widget#modify_base(state, color) for certain widgets
(Gtk::Entry, Gtk::TreeView). Not sure if GnomeCanvas supports those but
it's worth a try.

martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top