Based on an earlier e-mail I sent I was confused about using pathnames in rc files to do something really simple like set the background color of a gtkbutton using rc files. I've attached four things:

1. rc - simple rc file to set a background color on a button based
   on a widget hierarchy pattern

2. test.glade - a simple glade layout

3. glade.py - simple python code to load test.glade file and use rc
   style

4. noglade.py - another simple python script to replicate the widget
   hierarchy being used in test.glade w/o using glade to generate the
   layout

The hierarchy given in both glade.py and noglade.py is:
-- GtkWindow -> GtkVBox -> GtkButton

However, running glade.py and noglade.py gives conflicting results, yet everything appears to be the same? How come the rc style rule doesn't work when the gui is generated with glade??? Am I missing something really obvious or is this a bug?


Thanks,
  Chris
style "button-style"
{
    bg[NORMAL] = { 1.0, 0, 0 }
}
widget "window.*.GtkButton" style "button-style"

Attachment: test.glade
Description: application/glade

#!/usr/bin/python
import gtk, gtk.glade, sys

gtk.rc_parse('rc')
w = 'window'
wTree = gtk.glade.XML('test.glade', w)
win = wTree.get_widget(w)
win.set_name(w)


win.show_all()
try:
    gtk.main()
except KeyboardInterrupt:
    sys.exit(0)
#!/usr/bin/python
import gtk, sys

gtk.rc_parse('rc')

w = gtk.Window()
w.set_name('window')

v = gtk.VBox()
b = gtk.Button('button')
v.add(b)
w.add(v)

w.set_size_request(200,200)
w.show_all()

try:
    gtk.main()
except KeyboardInterrupt:
    sys.exit(0)
_______________________________________________
pygtk mailing list   [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to