[pygtk] rc file woes

Augusto Roccasalva coyotevz at gmail.com
Mon Nov 26 23:31:35 WST 2007


El día Sun, 25 Nov 2007 12:17:38 -0500
Chris Cole <ccole2 en 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"

Best regards,
--Augusto


More information about the pygtk mailing list