Python Forum
Tkinter menu font size -method to change - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/Forum-Python-Coding)
+--- Forum: GUI (https://python-forum.io/Forum-GUI)
+--- Thread: Tkinter menu font size -method to change (/Thread-Tkinter-menu-font-size-method-to-change)



Tkinter menu font size -method to change - tonycat - Oct-10-2020

Hello,

        How can I change the Tkinter menu font size, I can change the font size of other components , except menu Huh Huh Huh
 
 
import tkinter as tk
from tkinter import ttk
from tkinter import *
import tkinter.font as tkfont
root = tk.Tk()
root.option_add("*Font", ('Verdana', 30))
label = tk.Label(root, text = "Hello World")
label.pack(padx = 5, pady = 5)
menubar = tk.Menu(root)
menubar.add_command(label="Python", command=lambda: print("Python"))
menubar.add_command(label="Quit", command=root.destroy)
root.config(menu=menubar)

root.mainloop()
thank!


RE: Tkinter menu font size -method to change - Maryan - Oct-10-2020

ex.
self.file.add_command = (font = 'Helvetica 12 bold')


RE: Tkinter menu font size -method to change - tonycat - Oct-11-2020

(Oct-10-2020, 06:30 PM)Maryan Wrote: ex.
self.file.add_command = (font = 'Helvetica 12 bold')

Thanks !

I change it to class , it works for the level of submenu, fonts.. but the parent menu object (Main, File and testl), not work. , ….. Huh Huh Huh
 
from tkinter import *
 
class tiger:
    def __init__(self):
        self.tk = Tk()
      
        self.menu = Menu(self.tk,font= 'Helvetica 50 bold')                     # no effect
        self.tk.config(menu=self.menu)
 
        self.main_menu = Menu(self.menu, tearoff=0,font= 'Helvetica 50 bold')   # no effect
        self.main_menu .add_command(label="StartScreen",font= 'Helvetica 25 bold')
        self.main_menu .add_command(label="Settings",font= 'Helvetica 25 bold')
        self.main_menu .add_command(label="Exit",font= 'Helvetica 25 bold')
        self.menu.add_cascade(label="Main", menu=self.main_menu,font= 'Helvetica 50 bold')
       
       
        #self.file.add_command = (font = 'Helvetica 12 bold')
 
        self.file_menu = Menu(self.menu, tearoff=0,font= 'Helvetica 50 bold')  #no ettect
        self.file_menu.add_command(label="Open",font= 'Helvetica 25 bold')
        self.file_menu.add_command(label="Save",font= 'Helvetica 25 bold')
        self.file_menu.add_command(label="Print",font= 'Helvetica 25 bold')
        self.menu.add_cascade(label="File", menu=self.file_menu)
 
        self.test_menu = Menu(self.menu, tearoff=0,font= 'Helvetica 50 bold')  # no effect
        self.test_menu.add_command(label="Test")
        self.menu.add_cascade(label="Test", menu=self.test_menu)
 
tiger()
 
mainloop()
difficult stuff for me to solve... Wall Wall Wall