On Mon, 2002-04-29 at 15:46, Janos Blazi wrote:
> How can I set the colours of a widget in PyGtk?
> 
> In C I could try
> 
> GdkColor col;   
> gdk_color_parse ("red", &col);   gtk_widget_modify_bg(widget,
> GTK_STATE_NORMAL, &col);
> 
> I tried 
> col=gtk.gdk.Color()
> but this does not seem to work.

That allocates the color then you have to assign the color to a widgets
style. e.g.

color = wid.get_colormap().alloc("red")
s = wid.get_style().copy()
s.fg[gtk.STATE_NORMAL] = color

If you don't use the copy() when you get the style you will change the
color on every widget using that style.

> 
> J.B.
> 
> -- 
> GMX - Die Kommunikationsplattform im Internet.
> http://www.gmx.net
> 
> _______________________________________________
> pygtk mailing list   [EMAIL PROTECTED]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
-- 
Steve McClure                   430 10th St NW
Racemi                          Suite N-210
http://www.racemi.com           Atlanta, GA 30318
[EMAIL PROTECTED]             voice/fax: 404-892-5850

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to