canvas.create_oval(randint(0, 399), randint(0, 299), 15, 15, fill='red')
draw()
canvas.pack()
root.bind('<space>', draw)
root.mainloop()
How to bind spacebar key to a certain method in tkinter (python)