Miguel Soler Vicedo
Miguel Soler Vicedo

Reputation: 43

Stuck using fonts on tkinter for python 3.x.

Basically, I can't set the "underline" and "overstrike" options. My code works perfectly until I try to add those parameters in as a label font:

Large_Font = ("Verdana", 10, "bold", "italic", "underline and overstrike")

...

Lbl = tk.Label(frame_1, text = "Data", font = Large_Font)

No matter if I type "0 or 1" or "True or False". Anyone can help me out?

Thank you!

Upvotes: 0

Views: 307

Answers (1)

Lafexlos
Lafexlos

Reputation: 7735

You should create a new Font instance and change its underline and overstrike attributes to True.

from tkinter import font

large_font = font.Font(family="Verdana", size=10, weight="bold", slant="italic", underline=True, overstrike=True)

or

large_font = font.Font(family="Verdana", size=10)
large_font.configure(weight="bold")
large_font.configure(slant="italic")
large_font.configure(underline=True)
large_font.configure(overstrike=True)

Upvotes: 1

Related Questions