title: How to use a turtle superclass
body: <p>I'm making a solar system replica using turtle graphics.
  I want to make a star and a planet that both inherit from the same turtle superclass "solar_element", but I'm having problems.</p>
  
  <p>I can make the star and planet using two different turtle classes with no problems:</p>
  
  <pre><code>from turtle import Turtle
  
  class star(Turtle):
     def __init__(self, Name, Radius, Mass, Colour):
      Turtle.__init__(self, shape = "circle")
      self.Name = Name
      self.Radius = Radius
      self.Mass = Mass
      self.color(Colour)
      self.shapesize(self.Radius/50)
  
  class planet(Turtle):
   def __init__(self, Name, Radius, Mass, Colour, Dist, velX, velY):
      Turtle.__init__(self, shape= "circle")
      self.Name = Name
      self.Radius = Radius
      self.Mass = Mass
      self.color(Colour)
      self.Dist = Dist
      self.velX = velX
      self.velY = velY
      self.x_pos = sun.Radius + self.Dist + self.Radius
      self.y_pos = 0
      self.shapesize(self.Radius/50)
  
  sun = star('myStar', 500.0, 15000.0, "yellow");
  earth = planet('P1', 150.0, 1000.0, "green", 0.25, 0.5, 2.0);
  </code></pre>
  
  <p>But when I try to make them inherit from one superclass, like this:</p>
  
  <pre><code>from turtle import Turtle
  
  class solar_element(Turtle):
   def __init__(self, Name, Radius, Mass, Colour):
      self.Name = Name
      self.Radius = Radius
      self.Mass = Mass
      self.Colour = Colour
      self.color(self.Colour)
      self.shapesize(self.Radius/50)
  
  class star(solar_element):
   def __init__(self, Name, Radius, Mass, Colour):
      solar_element.__init__(self, Name, Radius, Mass, Colour)
      Turtle.__init__(self, shape = "circle")
  
  class planet(solar_element):
   def __init__(self, Name, Radius, Mass, Colour, Dist, velX, velY):
      solar_element.__init__(self, Name, Radius, Mass, Colour)
      Turtle.__init__(self, shape = "circle")
      self.Dist = Dist
      self.velX = velX
      self.velY = velY
      self.x_pos = sun.Radius + self.Dist + self.Radius
      self.y_pos = 0
  
  sun = star('myStar', 500.0, 15000.0, "yellow");
  earth = planet('P1', 150.0, 1000.0, "green", 0.25, 0.5, 2.0);
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre class="lang-none prettyprint-override"><code>Traceback (most recent call last):
    File "C:\Users\Kev\Dropbox\OOP\testing_classes.py", line 62, in &lt;module&gt;
      sun = star('myStar', 500.0, 15000.0, "yellow");
    File "C:\Users\Kev\Dropbox\OOP\testing_classes.py", line 47, in __init__
      solar_element.__init__(self, Name, Radius, Mass, Colour)
    File "C:\Users\Kev\Dropbox\OOP\testing_classes.py", line 42, in __init__
      self.color(self.Colour)
    File "C:\Python33\lib\turtle.py", line 2208, in color
      pcolor = self._colorstr(pcolor)
    File "C:\Python33\lib\turtle.py", line 2688, in _colorstr
      return self.screen._colorstr(args)
  AttributeError: 'star' object has no attribute 'screen'
  </code></pre>
  
  <p>I realize I could just stick with two classes but I want to use a superclass, as I'm still trying to learn python.</p>