Active Topics

 


Reply
Thread Tools
daperl's Avatar
Posts: 2,427 | Thanked: 2,986 times | Joined on Dec 2007
#11
Originally Posted by luis View Post
Acutally, I have a gtk.messagedialog. I tried with vbox, action_area and label, and the actual dialog font stays the same.
Interesting. It looks like you get to go down the myMessageDialog.set_markup(myPangoMarkupStr) rabbit hole. This will lead you here:

Pango Markup Language

It doesn't look too bad. Report back!
__________________
N9: Go white or go home
 
Posts: 146 | Thanked: 15 times | Joined on Oct 2008
#12
Originally Posted by daperl View Post
Interesting. It looks like you get to go down the myMessageDialog.set_markup(myPangoMarkupStr) rabbit hole. This will lead you here:

Pango Markup Language

It doesn't look too bad. Report back!
Wow... How can this be so complicate??
I also tried the routine with a gtk.combolist without success.

I will see what I can do.

Thanks!!
L.
 
daperl's Avatar
Posts: 2,427 | Thanked: 2,986 times | Joined on Dec 2007
#13
Originally Posted by luis View Post
Wow... How can this be so complicate??
It's kinda cool when you think about it. From the example just try the following:

Code:
myMessage = 'Blue text'
fontSize = 100
myMessageDialog.label.set_markup("<span foreground=\"blue\" size=\"%d\">%s</span> is <i>cool</i>!" % (fontSize,myMessage))
__________________
N9: Go white or go home
 
Posts: 146 | Thanked: 15 times | Joined on Oct 2008
#14
Originally Posted by daperl View Post
It's kinda cool when you think about it. From the example just try the following:

Code:
myMessage = 'Blue text'
fontSize = 100
myMessageDialog.label.set_markup("<span foreground=\"blue\" size=\"%d\">%s</span> is <i>cool</i>!" % (fontSize,myMessage))
The only thing I see is "is cool!", with "cool" in italics, and with the same usual font. That is, no "Blue text", and the same old fonts.

Anyway, could I apply this to change the fonts inside a gtk.ComboBox?

Thanks,
L.

Last edited by luis; 2009-09-01 at 18:22.
 
daperl's Avatar
Posts: 2,427 | Thanked: 2,986 times | Joined on Dec 2007
#15
Originally Posted by luis View Post
The only thing I see is "is cool!", with "cool" in italics, and with the same usual font. That is, no "Blue text", and the same old fonts.

Anyway, could I apply this to change the fonts inside a gtk.ComboBox?

Thanks,
L.
Oh yeah, sorry. I think the example is using a bad size value. Try 7200 instead of 100.

Here's the size parameter definition from the reference page:

The font size in thousandths of a point, or one of the absolute sizes 'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large', or one of the relative sizes 'smaller' or 'larger'.
__________________
N9: Go white or go home
 

The Following User Says Thank You to daperl For This Useful Post:
daperl's Avatar
Posts: 2,427 | Thanked: 2,986 times | Joined on Dec 2007
#16
Originally Posted by luis View Post
Anyway, could I apply this to change the fonts inside a gtk.ComboBox?
Yes, gtk.ComboBox implements the gtk.CellLayout interface. It's mildly complex, so maybe start at this tutorial.
__________________
N9: Go white or go home
 

The Following User Says Thank You to daperl For This Useful Post:
Posts: 146 | Thanked: 15 times | Joined on Oct 2008
#17
Originally Posted by daperl View Post
Yes, gtk.ComboBox implements the gtk.CellLayout interface. It's mildly complex, so maybe start at this tutorial.
Yeah! It worked. Just for the record, this is what I did:

When defining the combobox:

self.history = gtk.ListStore(str)
self.combohist = gtk.ComboBox(self.history)
self.histtxt = gtk.CellRendererText()
self.combohist.pack_start(self.histtxt, True)
self.combohist.add_attribute(self.histtxt, 'text', 0)

And then changing the font is easy:

self.histtxt.set_property('font',"sans 18")

Thanks!!!!!!
L.
 
Posts: 146 | Thanked: 15 times | Joined on Oct 2008
#18
Originally Posted by daperl View Post
Oh yeah, sorry. I think the example is using a bad size value. Try 7200 instead of 100.
Yep, it worked. (I think it worked before, but I was unable to see the microscopic text...)

Thanks again,
L.
 
rcull's Avatar
Posts: 299 | Thanked: 168 times | Joined on Jun 2006 @ Wales UK
#19
At the risk of being too simplistic - whats wrong with this:-

gtk.rc_parse_string("""
style "font"
{
font_name = "Sans 12"
}
widget_class "*" style "font" """)
 
Posts: 146 | Thanked: 15 times | Joined on Oct 2008
#20
Originally Posted by daperl View Post
Yes, gtk.ComboBox implements the gtk.CellLayout interface. It's mildly complex, so maybe start at this tutorial.
Sorry but... there is another problem with this. My solution actually changed the font size of the combobox, but not the row height (!!?). So, it is essentially useless, because the letters are cut.

Changing fonts should be a trivial thing, no?

Thanks once again,
L.
 
Reply


 
Forum Jump


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