def togglepattern():
global togsw,o,ovl,gui,alphaValue
# if overlay is inactive, ignore button:
if togsw == 0:
print "Pattern button pressed, but ignored --- Crosshair not visible."
# if overlay is active, drop it, change pattern, then show it again
else:
if guivisible == 0:
# reinitialize array:
ovl = np.zeros((height, width, 3), dtype=np.uint8)
patternswitch(ovl,0)
if o != None:
camera.remove_overlay(o)
o = camera.add_overlay(np.getbuffer(ovl), layer=3, alpha=alphaValue)
else:
# reinitialize array
gui = np.zeros((height, width, 3), dtype=np.uint8)
creategui(gui)
patternswitch(gui,1)
if o != None:
camera.remove_overlay(o)
o = camera.add_overlay(np.getbuffer(gui), layer=3, alpha=alphaValue)
return
评论列表
文章目录