Truly custom font in Tkinter

后端 未结 6 1183
悲哀的现实
悲哀的现实 2020-11-29 10:28

I am making an interface in Tkinter and I need to have custom fonts. Not just, say, Helvetica at a certain size or whatever, but fonts other than what would normally be ava

6条回答
  •  天命终不由人
    2020-11-29 10:36

    this worked for me on windows but doesn't seem to work on linux:

    import pyglet,tkinter
    pyglet.font.add_file('file.ttf')
    
    root = tkinter.Tk()
    MyLabel = tkinter.Label(root,text="test",font=('font name',25))
    MyLabel.pack()
    root.mainloop()
    

提交回复
热议问题