Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'd like to change font attributes (size, style, family, colour) for Text Entry but I don't see any option for this in Glade. There's no problem with Label, but Label is not editable by user. I tried to edit the MyAppNameWindow.ui file in Gedit and copied attributes from Label to Text Entry but after that the app does not start.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

I do not know how to do this using Glade. However, this is simple to achieve using a small piece of code.

I assume you are using quickly, and thus you write in Python.

  • First, you need to import Pango library (it comes by default with Gtk)

    from gi.repository import Pango

  • Then, assuming your entry widget is called myentry:

    myentry.modify_font(Pango.FontDescription('Sans Bold 12'))

Adjust the above to your needs, and remember place that instruction somewhere in initialization code, so that it gets executed just after the window is constructed.

I hope such non-Glade solution will help you.

share|improve this answer
    
Thanks, it does work. I tried before with import pango but got some error. –  mivoligo Jun 26 '12 at 22:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.