keydown01.py

Created by vef03715

Created on February 01, 2021

626 Bytes


import time
from kandinsky import *
from turtle import *
from ion import *

def keydown01():
  reset()
  tf=True
  x,y=0,0
  while tf:
    draw_string(str(tf),100,90)
    draw_string(str(x),100,120)
    draw_string(str(y),100,150)
    goto(x,y)
    if keydown(KEY_LEFT):
      x-=1
      if x<-150:
        x=-150
    elif keydown(KEY_RIGHT):
      x+=1
      if x>150:
        x=150
    elif keydown(KEY_UP):
      y+=1
      if y>100:
        y=100
    elif keydown(KEY_DOWN):
      y-=1
      if y<-100:
        y=-100
    elif keydown(KEY_OK):
      tf=False
    else:
      tf=True
    time.sleep(0.005)

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.