The following line:
my_font = tk.font.Font(size=20)
Gives me the following error:
module tkinter
has no attribute font
How to fix this.
CodePudding user response:
font
is imported separately from the main tkinter
This should work for you
import tkinter as tk
from tkinter.font import Font
Then you can do this
root = tk.Tk()
my_font = Font(root, size=20)
CodePudding user response:
It should be like this.
import tkinter.font as tkFont
myFont = tkFont.Font(root, size=20)