Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
why can't i used ESC key??
#1
this is my code
import turtle as t

def blank():
    t.clear()


t.speed(0)
t.pensize(2)
t.shape("turtle")
t.onscreenclick(t.goto)
t.onkeypress(blank, "Escape")
why can't i used ESC key??
Reply
#2
You need to get turtle to listen to events, and you need to start turtle's event processing loop. Put these at the end of your code:

t.listen()
t.mainloop()
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020