Reputation: 11
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.
Upvotes: 0
Views: 72
Reputation: 4543
It should be like this.
import tkinter.font as tkFont
myFont = tkFont.Font(root, size=20)
Upvotes: 0
Reputation: 6780
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)
Upvotes: 1