Logo Search packages:      
Sourcecode: jack version File versions  Download package

def lifedemo::LifeBoard::toggle (   self,
  y,
  x 
)

Toggle a cell's state between live and dead

Definition at line 63 of file lifedemo.py.

00063                           : 
      """Toggle a cell's state between live and dead"""
      if x<0 or self.M<=x or y<0 or self.N<=y:
          raise ValueError, "Coordinates out of range %i,%i"% (y,x)
      if self.state.has_key(x,y): 
          del self.state[x,y]
          self.scr.addch(y+1, x+1, ' ')
      else:
          self.state[x,y]=1
          self.scr.addch(y+1, x+1, self.char)
      self.scr.refresh()


Generated by  Doxygen 1.6.0   Back to index