[Tkinter-discuss] Re: How to change font sizes in a Tkinter app?

stewart at midtoad.homelinux.org stewart at midtoad.homelinux.org
Tue Sep 14 17:27:23 CEST 2004

Quoting Martin Franklin <mfranklin1 at gatwick.westerngeco.slb.com>:

> Sorry Jeff not sure I follow are you saying this :
.. snip code sample ... 
> does not show a different font on your Windows system?

I confess I'm confused by that as well.   When I check your code sample, I see
that the 'File' menu item is indeed in a larger font size.   And indeed, if I
modify that sample (see below) to add a font specification for every item in the
menu, they all take a new font - except for the top-level menu item ("Menu").
Perhaps that's what Jeff means. 

With the app that I posted a little while ago, every level of my menubar takes a
new font *except* for the system menu - but since the system menu is not
normally used in running an app, I don't mind that. 


import Tkinter
import sys

myFont = ("Helvetica", 18)

t = Tkinter.Tk()
mb = Tkinter.Menu(t, font=myFont)
mbm = Tkinter.Menu(mb, font=myFont)
mbm.insert_cascade("end", label="File", underline=0, font=myFont)
mbm.insert_cascade("end", label="Edit", underline=0, font=myFont)
mbm.insert_cascade("end", label="Help", underline=0, font=myFont)
mbm.insert_cascade("end", label="Quit", underline=0, font=myFont,
                    command=lambda: sys.exit("Bye"))
t["menu"] = mb

mb.add_cascade(menu=mbm, label="Menu", font=myFont)

More information about the Tkinter-discuss mailing list