#!/usr/bin/env python """ A marker control server """ import socket from servo import ServoControl host = '' port = 50001 backlog = 5 size = 1024 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((host, port)) s.listen(backlog) marker = ServoControl(11) while 1: client, address = s.accept() while True: data = client.recv(size) if data: marker.move_marker(data) else: break client.close()
menu = Menu(root, level=1000, pos=(10, 10), margin=2, itemsize=(120, 28), vertical=True) menu.add_item('bark1', barker('bark1')) menu.add_item('bark2', barker('bark2')) menu.add_item('bark3', barker('bark3')) menu.add_item('bark3', barker('bark3')) menu.add_item('bark3', barker('bark3')) menu.add_item('bark3', barker('bark3')) menu.add_item('bark3', barker('bark3')) menu.add_item('bark3', barker('bark3')) menu.hide() def show_menu(event): if menu.is_visible(): menu.pos = event.pos else: menu.pos = event.pos menu.show() root.bind(EV_RCLICK, show_menu, BLK_POST_BLOCK) root.bind(EV_CLICK, menu.hide, BLK_POST_BLOCK) fpsmeter = FPSMeter(root, pos=(0, 0)) root.on_loop = fpsmeter.count controller = ServoControl(root, size=(800, 700), pos=(200, 10)) controller.new_servos() # ser1 = ServoBoard(root, sid=3, bias=512, size=(630, 100), pos=(100, 20), direction=1) # ser2 = ServoBoard(root, sid=3, bias=512, size=(630, 100), pos=(100, 122), direction=1) # root.mainloop()
#!/usr/bin/env python """ A marker control server """ import socket from servo import ServoControl host = '' port = 50001 backlog = 5 size = 1024 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((host,port)) s.listen(backlog) marker = ServoControl(11) while 1: client, address = s.accept() while True: data = client.recv(size) if data: marker.move_marker(data) else: break client.close()
def __init__(self): CameraApi.__init__(self) FaceApi.__init__(self) CanvasApi.__init__(self) if do_servo: ServoControl.__init__(self)