[Tutor] Fonts for Canvas text items ?

Georg Simon georg.simon@bnmsp.de
Sun, 11 Feb 2001 18:35:36 +0100


Python 2.0 and Windows 98

To find out how to change the font for a text item on a Canvas, I tried
the following code. But the only effect I get is on the size of the
font. The larger size appears in the first three lines, the tiny size in
the last line.

How can I get different fonts, different thickness, different size ?

Georg Simon


from Tkinter import *

Wurzel=Tk()

Leinwand = Canvas(Wurzel)

Leinwand.create_text(50,50,text="Helvetica",font="Helvetica")
Leinwand.create_text(50,100,text="NewCourier",font="NewCourier")
Leinwand.create_text(50,150,text="bold",font="bold")
Leinwand.create_text(50,200,text="no font")

Leinwand.pack()

Wurzel.mainloop()