March 2018
Beginner to intermediate
422 pages
10h 33m
English
In addition to the aforementioned method of handling fonts, Tkinter provides a separate Font class implementation. The source code for this class is located in the same folder as the source code for Tkinter.
On my Linux machine, the source code is located in /usr/local/lib/python3.6/tkinter/font.py. On Windows (with a default Python 3.6 install) the location is C:\Program Files (x86)\Python36-32\Lib\tkinter\font.py.
To use this module, you need to import fonts into your namespace, as follows (see the 10.08_font_demo.py code):
from tkinter import Tk, Label, Packfrom tkinter import fontroot = Tk()label = Label(root, text="Humpty Dumpty was pushed")label.pack()current_font = font.Font(font=label['font'])print ('Actual ...Read now
Unlock full access