Table of Contents
Example Description
The example demonstrates how to use hand recognition and pen extensions to make an air draw game in the Python Coding Environment.

Code

sprite = Sprite('Pencil')

hand = Posenet()
pen = Pen()

hand.video("on", 0)
hand.disablebox()

pen.clear()
pen.setcolor([0, 255, 0])
pen.setsize(2)

while True:
  hand.analysehand()
  if hand.ishanddetected():
    if sprite.iskeypressed("space"):
      pen.down()
      sprite.setx(hand.gethandposition(1, 8))
      sprite.sety(hand.gethandposition(2, 8))
    else:
      pen.up()

Output