def sel(): global button, stage, lipMaxRaw, lipMinRaw if stage == 2: root.destroy() picoh.reset() picoh.wait(1) picoh.close() sys.exit() if stage == 1: ResetRangeToRawMin() label.config(text="All done!") stage = 2 button.config(text="Close") if stage == 0: selection = "Value = " + str(var.get()) label.config( text= "Slowly move the slider to the right, stop when the bottom lip pops the top lip into a smile." ) button.config(text="Set Smile Point") ResetRangeToRawCentre() stage = 1 # Set headnod to 5 picoh.move(picoh.HEADNOD, 10) # Move bottom lip to 4 picoh.move(picoh.BOTTOMLIP, 4) # Wait 250ms picoh.wait(0.25) # Move bottom lip to 6 picoh.move(picoh.BOTTOMLIP, 6)
picoh.wait(1) # Move the HEADTURN and EYETURN to position 7. picoh.move(picoh.HEADTURN, 7) picoh.move(picoh.EYETURN, 7) # Set the base to red:3/10 green: 4/10 and blue 2/10. picoh.setBaseColour(3, 4, 2) picoh.wait(1) # Change the base to orange picoh.setBaseColour(10, 3, 0) # Set the eyeshape to SunGlasses picoh.setEyeShape("SunGlasses") # Slowly increase the brightness of Picoh's eyes. for x in range(0, 50): picoh.setEyeBrightness(x / 10) picoh.wait(0.2) # Get a random phrase from the speech database. phrase = picoh.getPhrase() picoh.say(phrase) # Wait a few seconds and then close. This detaches Picoh's motors. picoh.wait(3) picoh.close()
def on_closing(): picoh.reset() picoh.wait(1) picoh.close() win.destroy()