3

I have TextView widget in Glade named "formula-view". I'm trying to do this to change font:

formulaView = self.builder.get_object("formula-view")
fontdesc = pango.FontDescription('Ubuntu 16')
formulaView.override_font(fontdesc)

But this works with error. How to correctly change font?

I just want to change the font of a widget, but I don't know how to do it. Error looks like this: AttributeError: type object 'Context' has no attribute '__info__'

  • Could you be more specific? Which kind of error are you getting? – David Planella Jun 20 '12 at 7:37
  • I just want to change the font of a widget, but I don't know how to do it. Error looks like this: AttributeError: type object 'Context' has no attribute '__info__' – Valery Tolstov Jun 20 '12 at 8:26
1

Try doing this instead:

tv = self.builder.get_object('textview')
font = pango.FontDescription('Ubuntu 16')
tv.modify_font(font)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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