Reply
Thread Tools
rcull's Avatar
Posts: 299 | Thanked: 168 times | Joined on Jun 2006 @ Wales UK
#31
luis

You may have tried this but below is an extract from advoid where I add my own label to a button (there is also an icon on the button now)
It may help

Code:
        self.DoButtLab=gtk.Label("Update\nmy\nSystem")
        self.DoButtLab.set_justify(gtk.JUSTIFY_CENTER)
        self.DoButtLab.show()
        self.DoButt=gtk.Button()
        self.Dbox=gtk.HBox(True,0)
        self.Dbox.pack_start(self.DoButtLab,True,True,0)
        self.DoButt.add(self.Dbox)
        self.Dbox.show()
        self.DoButt.connect("clicked",self.Upd_Host_File)
Rick
 

The Following User Says Thank You to rcull For This Useful Post:
Posts: 146 | Thanked: 15 times | Joined on Oct 2008
#32
Originally Posted by rcull View Post
luis

You may have tried this but below is an extract from advoid where I add my own label to a button (there is also an icon on the button now)
It may help

Code:
        self.DoButtLab=gtk.Label("Update\nmy\nSystem")
        self.DoButtLab.set_justify(gtk.JUSTIFY_CENTER)
        self.DoButtLab.show()
        self.DoButt=gtk.Button()
        self.Dbox=gtk.HBox(True,0)
        self.Dbox.pack_start(self.DoButtLab,True,True,0)
        self.DoButt.add(self.Dbox)
        self.Dbox.show()
        self.DoButt.connect("clicked",self.Upd_Host_File)
Rick
Mmmm... so you build the button yourself for it to obey the command. Strange that the natural setting works in the PC and not in the N800.

Thanks again,
L.
 
rcull's Avatar
Posts: 299 | Thanked: 168 times | Joined on Jun 2006 @ Wales UK
#33
luis

The main reason for putting your own label in a box in a button is that it is the only way of having both a label and an image on the same button.

Try

widget_class "*<GtkLabel>" style "label-font"

I think this says alter any widget which has a label inside it ( I havn't tried this myself )

Rick
 

The Following User Says Thank You to rcull For This Useful Post:
Posts: 146 | Thanked: 15 times | Joined on Oct 2008
#34
You're a patient man...

Originally Posted by rcull View Post
luis
Try

widget_class "*<GtkLabel>" style "label-font"

I think this says alter any widget which has a label inside it ( I havn't tried this myself )
Yes, this worked!!! Actually, too well. It changes fonts even inside menus for example, that I don't want. I only want to change the button fonts. So it should be something like:

widget_class "GtkButton<GtkLabel>" style "label-font"

or

widget_class "<GtkButton>*" style "label-font"

but these do not work...

Thnks,
L.
 
rcull's Avatar
Posts: 299 | Thanked: 168 times | Joined on Jun 2006 @ Wales UK
#35
luis

try widget_class "<GtkButton>.<GtkLabel>" style "label-font"
or widget_class "*.<GtkButton>.<GtkLabel>" style "label-font"

if you run a linux system do a 'more' on

/usr/share/themes/ClearlooksClassic/gtk-2.0/gtkrc

for clues or any of the themes gtkrc files. The tablet themes gtkrcs also but they are a bit more involved.

Rick
 

The Following 2 Users Say Thank You to rcull For This Useful Post:
Posts: 146 | Thanked: 15 times | Joined on Oct 2008
#36
Spot on! Worked perfectly now. Just for the record again, this is my (yours!) final code:

Code:
    def makefont(self):
    Settings=gtk.settings_get_for_screen(gdk.screen_get_default())

        gtk.rc_parse_string("""
                style "general"
                {
                    font_name = "sans """+str(self.font)+""" "
                }
                style "out"
                {
                    font_name = "sans """+str(self.font+6)+""" "
                }
                style "label"
                {
                    font_name = "sans bold """+str(self.font-4)+""" "
                }
                class "*" style "general"
                class "GtkTreeView" style "out"
                class "GtkLabel" style "label"
                widget_class "*<GtkButton>.<GtkLabel>" style "label"
                """)

        gtk.rc_reset_styles(Settings)
Thanks a lot for your time and patience!!

Best,
L.
 

The Following 2 Users Say Thank You to luis For This Useful Post:
rcull's Avatar
Posts: 299 | Thanked: 168 times | Joined on Jun 2006 @ Wales UK
#37
Good, its nice to put that one to bed. The thing is with these sort of problems is we all learn a bit.

I've used bits of this for my own code as well.

cheers
Rick
 
Reply

Thread Tools

 
Forum Jump


All times are GMT. The time now is 22:18.