0

I want make custom font in my label as @front-family in css ?

font = "C:/Users/Alex/Documents/myproject/Call of Ops Duty.otf"
mylabel = Label(main, text="This is a text", bg="black", fg="#fff", font=(font, 30))

and

mylabel = Label(main, text="This is a text", bg="black", fg="#fff", font=(Call of Ops Duty.otf, 30))

and

mylabel = Label(main, text="This is a text", bg="black", fg="#fff", font=("Call of Ops Duty", 30))

It does not work ;(

2 Answers2

0

You can't use fonts these way. Tkinter can only use fonts installed on the system.

Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685
0

The only fonts that you can use with Tkinter are the preset ones:

  1. TkDefaultFont
    Default for items not otherwise specified.
  2. TkTextFont
    Used for entry widgets, listboxes, etc.
  3. TkFixedFont
    A standard fixed-width font.
  4. TkMenuFont
    The font used for menu items.
  5. TkHeadingFont
    Font for column headings in lists and tables.
  6. TkCaptionFont
    A font for window and dialog caption bars.
  7. TkSmallCaptionFont
    A smaller caption font for tool dialogs.
  8. TkIconFont
    A font for icon captions.
  9. TkTooltipFont
    A font for tooltips.

https://tkdocs.com/tutorial/fonts.html

This means that you can't import your own font onto your labels