hmm dosent seem to work for me. I think im running gtk 2.6.8 (forgotten
how to check) newbie sorry
modifying the hello world example by adding one line
self.button.connect_object("clicked", gtk.Widget.destroy,
self.window)
self.button.modify_bg(gtk.STATE_NORMAL,gtk.gdk.color_parse("red"))
certainly doesnt make a red button.
I have noticed (on this machine) that when i mouse hover over the
button a thin orange border appears just inside the button edges, and
thats with or without my tampering.
i did try STATE_NORMAL, PREFLIGHT(which gave an error) and ACTIVE, none
made any difference.
RE style. Yes i did read thru some of the style stuff but it was a bit
beyond me and as this code will never see the visual cortex of any
other human being I didnt continue digging the whole.
Tony Nelson wrote:
At 12:03 PM +1000 1/31/06, vector wrote:
Im sure this has been dealt with b4 but I have searched and tried
various things and Im just not "getting" it.
>From what i read I think the labels background in the button is what i
want to set. Ergo i need to find the "child"!?.And this is where i fail.
# set up button
button = gtk.Button("hello")
#modify its color
child_label=gtk_bin_get_child (GTK_BIN (button))
child_label.modify_fg(gtk.STATE_NORMAL,gtk.gdk.color_parse("light pink"))
NameError: global name 'gtk_bin_get_child' is not defined
Im possibly not even close?
First, you are using the C syntax, not the Python syntax, which is
"button.get_child()".
Second, experimenting, I see that (contrary to the docs) setting the
background of a Button does work:
button.modify_bg(gtk.STATE_xxx, gtk.gdk.Color(r,g,b))
Where xxx is NORMAL for the resting state, PREFLIGHT for mouse hovering,
and ACTIVE for pressed. The colors don't overlap exactly, so all colors
should be related. Also, people will complain when you violate the theme
colors when you change them in any way.
There's also the Widget's Style object, normally set up by the theme.
(button.get_style(), etc.).
____________________________________________________________________
TonyN.:' <mailto:[EMAIL PROTECTED]>
' <http://www.georgeanelson.com/>
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
|
_______________________________________________
pygtk mailing list [email protected]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/