def check_1_callback(): global Check_1_Var global Send_Msg_On_Quit if Check_1_Var.get(): scamp.send_message(scamp.VS_MSG_HOST_ON, 0, 0) Send_Msg_On_Quit = True else: scamp.send_message(scamp.VS_MSG_HOST_DC, 0, 0) Send_Msg_On_Quit = False
command=slider_1_callback) Slider_1.pack() Send_Msg_On_Quit = False if Connection_Type == 'USB': Check_1_Var = tk.IntVar() Check_1 = tk.Checkbutton(tk_root, text="vs_gui_is_on()", variable=Check_1_Var, command=check_1_callback) Check_1.pack() print('open USB connection...') scamp.open_usb('0') else: print('open TCP connection...') scamp.open_tcp('127.0.0.1', 27888) # main_process() coopelia_api_ini() api_main_process() tk_root.mainloop() if Send_Msg_On_Quit: scamp.send_message(scamp.VS_MSG_HOST_DC, 0, 0) time.sleep(0.05) scamp.close() cv2.destroyAllWindows() print('End.') exit()