[pygtk] rc file woes

Chris Cole ccole2 at mix.wvu.edu
Tue Nov 27 07:42:03 WST 2007


Augusto Roccasalva wrote:
> El día Sun, 25 Nov 2007 12:17:38 -0500
> Chris Cole <ccole2 at mix.wvu.edu> escribió:
> 
>> Hey all,
>> I'm trying to set the background color of a button to red using rc 
>> files, but am running into some problems. Here's what I have in the rc file:
>>
>> style "button"
>> {
>>    bg[NORMAL] = { 1.0 , 0, 0 }
>> }
> 
> try with this:
> ---8<---
> style "button-style"
> {
>     bg[NORMAL] = { 1.0, 0, 0 }
> }
> widget "*.button" style "button-style"
> --->8---
> 
>> and sample code:
>>
>> #!/usr/bin/python 
>>
>> import gtk, sys
>>
>> gtk.rc_parse('rc')
>>
>> w = gtk.Window()
>> b = gtk.Button('foo')
>> b.set_name('button')
>> w.add(b)
>> w.set_size_request(300,300)
>> w.show_all()
>>
>> try:
>>      gtk.main()
>> except KeyboardInterrupt:
>>      sys.exit(0)
>>
> 
> see: http://www.moeraki.com/pygtkreference/pygtk2reference/class-gtkrcstyle.html
> "Pathnames and patterns"

Great! After reading the API a bit more things seem a little clearer, 
thanks for the nudge in the right direction. It seems however that I 
can't set the background color of a container, for example a GtkHBox or 
GtkVBox? Is this the case?

Thanks,
   Chris


More information about the pygtk mailing list