Changes

Jump to navigation Jump to search
Line 312: Line 312:     
  def myblock(lc,x):
 
  def myblock(lc,x):
# draw a dotted line of length x
+
    # draw a dotted line of length x
 
     # make sure x is a number
 
     # make sure x is a number
 
     if type(x) != int and type(x) != float:
 
     if type(x) != int and type(x) != float:
Line 335: Line 335:     
  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
 
     if type(x) != str:
 
     if type(x) != str:
 
         X = str(x).upper()
 
         X = str(x).upper()
Line 345: Line 345:     
  def myblock(lc,x):
 
  def myblock(lc,x):
# push hours, minutes, seconds onto the heap
+
    # push hours, minutes, seconds onto the heap
# use three pop blocks to retrieve the values
+
    # use three pop blocks to retrieve the values
# remember: the heap is a FILO (first in, last out)
+
    # remember: the heap is a FILO (first in, last out)
# the first value you will pop will be seconds
+
    # the first value you will pop will be seconds
 
     lc.heap.append(localtime().tm_hour)
 
     lc.heap.append(localtime().tm_hour)
 
     lc.heap.append(localtime().tm_min)
 
     lc.heap.append(localtime().tm_min)
Line 355: Line 355:     
  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
 
     # calculate the value (brightness) of the current color
 
     # calculate the value (brightness) of the current color
 
     val = 0.3 * lc.tw.rgb[0] + 0.6 * lc.tw.rgb[1] + 0.1 * lc.tw.rgb[2]
 
     val = 0.3 * lc.tw.rgb[0] + 0.6 * lc.tw.rgb[1] + 0.1 * lc.tw.rgb[2]
Line 367: Line 367:  
     # reallocate current color
 
     # reallocate current color
 
     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
 +
 +
def myblock(lc,x)
 +
    # save a screenshot in the journal
 +
    lc.tw.activity._do_saveimage_cb(lc.tw.activity)
 
  return
 
  return
  

Navigation menu