1.

Why Does Fontselection's Set_font_name Return False?

Answer»

It needs to be added to a window before the FONT lists are populated.

>>> w = gtk.Window()
>>> F = gtk.FontSelection()
>>> f.get_font_name()
'Sans 10'
>>> f.set_font_name('Sans 12')
False
>>> w.add(f)
>>> f.set_font_name('Sans 12')
True

Once added to the window, the RESULT will INDEED be True.

It needs to be added to a window before the font lists are populated.

>>> w = gtk.Window()
>>> f = gtk.FontSelection()
>>> f.get_font_name()
'Sans 10'
>>> f.set_font_name('Sans 12')
False
>>> w.add(f)
>>> f.set_font_name('Sans 12')
True

Once added to the window, the result will indeed be True.



Discussion

No Comment Found