[pygtk] setting color of gtk.Entry

Tony Nelson tonynelson at georgeanelson.com
Tue Dec 13 13:51:46 WST 2005


At 3:05 PM +1000 12/13/05, vector wrote:
>hi im trying to set the color of either the bg or the text in  a
>gtk.Entry box,  if "prompt" has text in it. code below.
>i cant seem to work out how to change the color tho?
>
>
>    def dem_entry(self,length,x,y,tiptxt):
>        """entry box for dem"""
>        self.dem = gtk.Entry()
>        self.dem.set_max_length(length)
>        self.dem.set_size_request(x,y)
>        self.dem.connect("activate", self.handle_dem_entry)
>        self.pack_start(self.dem, False, True)
>        if self.prompt!="":
>            self.dem.modify_bg(gtk.gdk.Color(0,0,0))
>        self.txttip.set_tip(self.dem,tiptxt, tip_private=None)

Gosh, I answered a very similar question just a few hours ago.  modify_base
or modify_text in the Widget class, and watch your state.
____________________________________________________________________
TonyN.:'                       <mailto:tonynelson at georgeanelson.com>
      '                              <http://www.georgeanelson.com/>


More information about the pygtk mailing list