Here is my version of the typewriter program. You can play with it, change the font face, change the size using the size variable and also change the letter spacing by modifying the corresponding variable value. Then, complete the tasks below.
import tkinter;
x=10;
y=20;
fontFace="Courier";
size=16;
letter_spacing=0.7;
def type(event):
global x,y;
canvas.create_text(x,y,text=event.char,font=fontFace+" "+str(size));
x=x+size*letter_spacing;
if (x>750 or event.keycode==13):
x=10;
y=y+size;
canvas=tkinter.Canvas(height=1024,width=780);
canvas.pack();
canvas.bind_all('<Key>',type)
Tasks:
Backspace
" key is 7
). Use an if-else structure for this.import tkinter;
x=50;
y=50;
canvas=tkinter.Canvas(height=1024,width=780);
canvas.pack();
for i in range (1000):
canvas.create_text(x,y,text="|",tag="cursor");
canvas.update();
canvas.after(500);
canvas.delete("cursor");
canvas.update();
canvas.after(500);