Python Forum
Tkinter menu font size -method to change
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tkinter menu font size -method to change
#1
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!
Reply
#2
ex.
self.file.add_command = (font = 'Helvetica 12 bold')
Reply
#3
(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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Tkinter - How can I change the default Notebook border color? TurboC 4 280 Oct-06-2020, 10:35 PM
Last Post: TurboC
  tkinter get method is not accepting value when called by function jagasrik 1 213 Sep-16-2020, 05:28 AM
Last Post: Yoriz
  tkinter get method is not accepting value jagasrik 4 212 Sep-15-2020, 05:41 PM
Last Post: jagasrik
  [Tkinter] How to Print a list = ['a','b','c'], using tkinter along with a custom font? Pleiades 2 227 Sep-15-2020, 03:54 PM
Last Post: Pleiades
  [Tkinter] Trying to change font size w/o changing button size python63 3 1,424 Aug-05-2020, 01:04 AM
Last Post: Larz60+
  [tkinter] color change for hovering over button teacher 4 857 Jul-04-2020, 06:33 AM
Last Post: teacher
  [PyQt] Increase text size and change color based on temp pav1983 5 395 Jun-22-2020, 10:52 PM
Last Post: menator01
  TKINTER - Change font color for night or day Ayckinn 2 683 May-24-2020, 09:25 PM
Last Post: Ayckinn
  Tkinter - Issues with "iconbitmap" method aquerci 3 980 May-21-2020, 09:46 AM
Last Post: aquerci
  access subitem in tkinter Menu Phraya 2 485 Apr-04-2020, 12:11 PM
Last Post: Phraya

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020