3 Replies - 6802 Views - Last Post: 26 December 2009 - 06:47 PM Rate Topic: -----

#1 scrace89  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 07-December 09

Python Class Help (Writing my own turtle)

Posted 07 December 2009 - 08:16 AM

So I have my first assignment involving classes and I am suppose to write a turtle class of my own as a part of a program that uses recursion to draw a Koch Snowflake and C Curve.

I have no idea how to start writing this class. This is my basic outline.

class Turtle:

	def __init__(self):
		pass
	def setColor(self, color):
		self.color = color

	def penDown(self):
		pass

	def penUp(self):
		pass

	def moveForward(self, distance):
		self.moveForward = distance

	def turn(self, degrees):
		self.turnRight = degrees




I need help writing what should be in each function for a graphics package to use.

I put what I thought would be correct and then how would I use this?

something like

turtle = turtle()

turtle.moveForward(distance)?

This post has been edited by scrace89: 07 December 2009 - 11:16 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Python Class Help (Writing my own turtle)

#2 chemicalfan  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 88
  • Joined: 16-October 09

Re: Python Class Help (Writing my own turtle)

Posted 07 December 2009 - 05:08 PM

I guess it depends on which graphics package you're talking about - do you have any ideas on this? Not my area at all I'm afraid, but might be able to help if you know what's going to be doing the bulk of the work!
Was This Post Helpful? 0
  • +
  • -

#3 scrace89  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 07-December 09

Re: Python Class Help (Writing my own turtle)

Posted 08 December 2009 - 11:57 AM

View Postchemicalfan, on 7 Dec, 2009 - 04:08 PM, said:

I guess it depends on which graphics package you're talking about - do you have any ideas on this? Not my area at all I'm afraid, but might be able to help if you know what's going to be doing the bulk of the work!


Its from john zelles python book.

http://www.cs.umbc.e...ickref.html#(1)

I'm just overwhelmed with this being out first assignment with classes and my teacher fails to teach or answer questions.
Was This Post Helpful? 0
  • +
  • -

#4 dave_6_10  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 55
  • Joined: 19-March 08

Re: Python Class Help (Writing my own turtle)

Posted 26 December 2009 - 06:47 PM

www.python.org has a lot of good tutorial materials, its helped me out a lot. More specifically If you study the turtle folders in your lib folder of whatever version of python you have you will find a lot of more useful resorces for turtle specifically.

I've had a few terrabytes of fun with tinkering around with turtle I am sure you will too. Let us know what specific version of the python interpreter you have because that alters how turtle works with your package.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1