Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python tkinter menu , how to change font?

Tags:

tkinter

Many sites say the Menu widget has an option 'font', but I've been unable to set it. System is Python 3.5 running in Windows 8.1 . Script starts:

  1. from tkinter import *
  2. root = Tk()
  3. root.geometry('1400x800+120+40')
  4. .
  5. .
  6. menubar = Menu(root)

All lines below have failed :

1. root.configure(font = ('Verdana',14))
2. root.option_add("*Font", ('Verdana', 14))
3. menubar = Menu(root, font = ('Verdana', 14))
4. menubar.configure(font = ('Verdana', 14))
5. menubar.add_command(label = "File", font = ('Verdana', 14))
6. default_font = Font.nametofont('Verdana')
7. default_font.configure(size = 14)

*Most of above give error " unknown option 'font' "*    
like image 758
dlemper Avatar asked Mar 11 '23 06:03

dlemper


1 Answers

Thanks scotty3785. Solved by changing the Menu font in Windows :

Windows System > Control Panel > Appearance > Display > Change Text Size > choose Menus

Now the menu font of tkinter is larger.

Might be said that Python's tkinter is not completely cross-platform.

like image 76
dlemper Avatar answered Mar 12 '23 19:03

dlemper