• Log in or sign up for an account here: https://www.sythe.org/login

"Etch a Sketch" Help

asdasd123

Forum Addict
Joined
Feb 2, 2012
Sythe Gold
0
Messages
417
If you don't know what it is
http://i.telegraph.co.uk/multimedia/archive/01677/dog_1677568i.jpg

Code:
#Setup document (800x600)
#Create the drawing surface -
from turtle import *


def move_up():
    setheading(90)
    forward(5)
    
def move_down():
    setheading(270)
    forward(5)
    
def move_left():
    setheading(180)
    forward(5)
    
def move_right():
    setheading(0)
    forward(5)

def clear_screen():
    clear()
    bgcolor("grey")
    st()


title("eTCH!")
speed(0)
bgcolor("grey")
setup(width=800, height=600)
penup()
pensize(3)
pendown()
onkey(move_up, 'Up')
onkey(move_down, 'Down')
onkey(move_left, 'Left')
onkey(move_right, 'Right')
onkey(clear_screen, 'c')
listen()
exitonclick()

What I want to know is how do I make it stop at the borders of the screen?
 
Runescape Gamblingrunescape gambling
Back
Top