I am trying to give a modern look to my tkinter GUI. Here is the syntax I am using without any luck. Any help will be greatly helpful!
from Tkinter import *
my_font=("Segoe UI", 20, "bold")
root =Tk()
root.geometry("800x480)
Label=(root, text="my label", font = my_font).place(x=320, y=10)
root.mainloop()
My answer is going to address two points
tkinter andPython 2
>>> from Tkinter import Tk
>>> from tkFont import families
>>> Tk(); available = families() ### Tk() is needed to have a running tcl interpreter
<Tkinter.Tk instance at 0x7f977bcbfb90>
>>> len(available)
3011
Python 3
>>> from tkinter import Tk
>>> from tkinter.font import families
>>> Tk() ; available = families()
<tkinter.Tk object .>
>>> len(available)
68
at this point you can examine the fonts that are available printing, sorting slicing etc the contents of available — nb the names listed are the names that you have to use in the font definition tuple as in your example code.
As far as I can tell, this could be done in general as a system dependent (complicated) hack and the only published one is ONLY for Windows.
Said hack (I'll repeat: Windows only) is reported in this SO answer.
I don't know how to proceed in general.
Footnote
3011 font families for Python 2 and 68 for Python 3? yes, Python 2 is the system Python installed by apt on my Debian pc, while Python 3 is Anaconda's one and sees just the fonts that Anaconda installed in its private tree.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With