Activities/Turtle Art-0.86: Difference between revisions

Line 279: Line 279:
Examples:
Examples:


from taturtle import *
  def myblock(lc,x):
  def myblock(lc,x):
  # draw a dotted line of length x
  # draw a dotted line of length x
Line 303: Line 302:
[[Image:TA-dotted-line.png]]
[[Image:TA-dotted-line.png]]


from taturtle import *
  def myblock(lc,x):
  def myblock(lc,x):
  # push an uppercase version of a string onto the heap
  # push an uppercase version of a string onto the heap
Line 314: Line 312:
  return
  return


from taturtle import *
  def myblock(lc,x):
  def myblock(lc,x):
  # push hours, minutes, seconds onto the heap
  # push hours, minutes, seconds onto the heap
Line 325: Line 322:
  return
  return


from taturtle import *
  def myblock(lc,x):
  def myblock(lc,x):
  # add a third dimension (gray) to the color model
  # add a third dimension (gray) to the color model
Line 340: Line 336:
     lc.tw.fgcolor = lc.tw.cm.alloc_color(r<<8,g<<8,b<<8)
     lc.tw.fgcolor = lc.tw.cm.alloc_color(r<<8,g<<8,b<<8)
  return
  return


===From the field===
===From the field===