[Tutor] Re: Changing fonts in Pmw ScrolledText object
Abel Daniel
abli at freemail.hu
Fri Mar 12 17:14:07 EST 2004
"Denson, William HDi" writes:
> How can I change font size in a Pmw ScrolledText aobject?
(you might get a better answer from the pmw-general maillist at
http://lists.sourceforge.net/lists/listinfo/pmw-general )
(not tested)
ScrolledText is basically a wrapper around Tkinter.Text, so you can
change the font size/color/etc. the same way as with a Tkinter.Text.
I think you will need to 'create' a font with the needed size with
import tkFont
font = tkFont.Font(...)
Then, you can add tags to the text with Tkinter.Text.tag_add(...)
and you can set what a tag means with Tkinter.Text.tag_config(...).
Pass your font object you created above to tag_config.
There is a very good Tkinter reference 'Tkinter reference: a GUI for Python'
in ps and pdf formats from http://www.nmt.edu/tcc/help/pubs/lang.html.
Using fonts is at page 7, using tags in Tkinter.Text at 51,
Tkinter.Text.tag_... methods are from page 56.
--
Abel Daniel
More information about the Tutor
mailing list