Ok some progress is being made
#!/usr/bin/python from sys import argv import zbar import turtle import time t = turtle.Pen() # create a Processor proc = zbar.Processor() # configure the Processor proc.parse_config('enable') # initialize the Processor device = '/dev/video0' if len(argv) > 1: device = argv proc.init(device) # enable the preview window proc.visible = True # read at least one barcode (or until window closed) for n in range(1, 5): proc.process_one() # hide the preview window proc.visible = False # extract results for symbol in proc.results: # do something useful with results print 'decoded', symbol.type, 'symbol', '"%s"' % symbol.data for n in range(1, 5): if (symbol.data == "forward5"): print "forward 5 pixels" time.sleep(1) turtle.forward(25) time.sleep(2) turtle.left(90) elif (symbol.data =="forward10"): print"forward 10 pixels" time.sleep(1) turtle.forward(100) time.sleep(2) turtle.left(90)
This however then runs the scanner 5 times then executes the loop 5 times depending on the last code scanned, so if i scan forward 5 4 times and then scan forward 10 once, it acts on the latter, rather than all of them.
still better than nothing,
I added the turtle.left(90) to make it easier to see, side effect you get a nice 5 or 10 pixel square with this.