program where i can merely draw on the screen using the arrow keys and turtle module. I have looked
on different tutorials and borrowed bits and pieces although i do not even know if
cturtle and turtle modules are the same. As you can probably tell this code is incomplete
and I would appreciate any help in getting it to function.
This is what I have so far
from turtle import * # Initiates turtle graphics width(7) #sets etch a sketch width class Draw: def Draw.__init__(self): super().__init__() pendown() self.color("black") self.pensize(5) self.speed(0) self.distance = 7 self.onKey(self.fd,"Up") self.onKey(self.bw,"Down") self.onKey(self.left,"Left") self.onKey(self.right,"Right") self.onKey(self.reset ,"c") self.listen() self.main() def fwd(self): self.forward(self.distance) def bkwd(self): self.backward(self.distance) def left(self): self.left(self.distance) def right(self): self.right(self.distance) def main(self): cTurtle.mainloop()
This post has been edited by atraub: 11 April 2012 - 06:04 PM