Write a GUI which displays 3 fonts on a canvas.
Here is the link to the sample code:
There are various options exercised in this sample. You may use different ones in your 3 font functions--a good idea to check them out--but your final code will not have all the extra stuff which this sample.py code has for illustration.
The canvas is given a width and height for the x and y axis dimensions, but y goes down instead of up as one may recall from usual math graphing practice. Below a canvas is created with differing x and y spans:
C = Canvas(W, width=400, height=300)
Take a piece of paper, draw your font, then figure out what kind of objects are needed (lines, rectangles, polygons, arcs, ...) to draw the font. Below, consider drawing a P, now find the (x,y) coordinate of points on the P, then use create_polygon to connect the dots.
Below is the source code of a program to create a Canvas and drw the P when the P button is pressed. Note that the Canvas background is black, and this is done by first drawing a black rectangle the size of the entire Canvas.
# canvas fun for P5 : p.py from Tkinter import * W = Tk() C = Canvas(W, width=400, height=300) C.pack() B=Button(W,text="Quit",command=quit) B.pack() def draw_p(): C.create_polygon( (250,100),(270,100),(290,120),(270,140),(250,140), (250,180),outline="green") Pbutton=Button(W,text="P",command=draw_p) Pbutton.pack() C.create_rectangle(0,0,400,300,fill="black") mainloop() # hang here forever, or until "Quit" button is pressed
Note that the order matters! The P is drawn on top of the black background. If things placed on the Canvas overlap, the last one is on top.
One can improve looks by little things. The image below has the width increased to 5.
def draw_p(): C.create_polygon( (250,100),(270,100),(290,120),(270,140),(250,140), (250,180),outline="green",width=5)