示例#1
0
from Tkinter import *
from ServoCatapult import *

############
#Initialize#
############

#Initialize the interface. MUST BE DONE BEFORE USING TKINTER!
interface = Tk()

#Define the Catapult
cat = ServoCatapult()

#Set debug output
cat.DEBUG = False



##################
#Callback Methods#
##################

###Trajectory Controls###
def angleCallBack(value):
    cat.changeAngle(int(value))

def yawCallBack(value):
    cat.changeYaw(int(value))

def tensionCallBack(value):
    cat.changeTension(int(value))
示例#2
0
from TkCatapultControl import *
from TkPictureFrame import *
from ServoCatapult import *

if __name__ == "__main__":
    root = Tk()

    picture = TkPictureFrame(300, 250, root)
    picture.grid(row=0, column=0)
    
    #catapult = SimpleCatapult()
    catapult = ServoCatapult()
    #catapult.DEBUG = True
    control = TkCatapultControl(catapult, root)
    catapult.timedDisarmPreExec = control.disableUICallback #ServoCatapult only
    catapult.timedDisarmPostExec = control.enableUICallback #ServoCatapult only
    #control.disableYaw() #Disable rotation UI
    control.grid(row=1, column=0)
    root.mainloop()