GTK+ Forums

Discussion forum for GTK+ and Programming. Ask questions, troubleshoot problems, view and post example code, or express your opinions.
It is currently Fri Oct 24, 2014 7:04 am

All times are UTC




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Change GtkEntry Color
PostPosted: Tue May 06, 2014 1:50 pm 
Offline

Joined: Tue May 06, 2014 12:25 am
Posts: 4
I need a way to chage the colors of a GtkEntry ( and TreeView as well ) so that the user can change the appearance of an application while an application is running. Can anyone give an example of how to do this using the C programming language? I'm using gtk+ 3 on Fedora , if that matters. Thanks for any input!


Top
 Profile  
 
 Post subject: Re: Change GtkEntry Color
PostPosted: Sun May 11, 2014 8:33 pm 
Offline
Familiar Face

Joined: Tue Oct 08, 2013 5:16 am
Posts: 20
I've tinkered with theming using Python a little bit. This is pretty basic, but it works for textviews and treeviews. I'd be interested in hearing how other people have done this. If you can convert it to C, the code I've used looks like this.

Code:
        bg = Gdk.Color.parse("#3c5541")[1]
        fg = Gdk.Color.parse("#eae28e")[1]
        hghlt = Gdk.Color.parse("#553c50")[1]
        ins = Gdk.Color.parse("#5c8263")[1]
        #Widget background
        #self.window.override_background_color(Gtk.StateType.NORMAL, ins)
        # Apply texview colors
        self.texview.modify_bg(Gtk.StateType.NORMAL, bg)
        self.texview.modify_fg(Gtk.StateType.NORMAL, fg)
        self.texview.modify_fg(Gtk.StateType.INSENSITIVE, ins)
        self.texview.modify_bg(Gtk.StateType.SELECTED, hghlt)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google Adsense [Bot] and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group