def task(cont = False): # Delete and redraw the current box Boxes.getCur().delete_rect(SelWindow.w).draw_rect(SelWindow.w) # Update the info text at the top SelWindow.w.delete(SelWindow.text) SelWindow.text = SelWindow.w.create_text((s.WINDOW_WIDTH/2, 10), text = str(Boxes.sel) + "selected - O = save output, 1-9 to change box num, T = toggle type, C = clear current box, close window to return to setup") if cont: SelWindow.master.after(2000,task) # reschedule event in 2 seconds
def task(cont=False): # Delete and redraw the current box Boxes.getCur().delete_rect(SelWindow.w).draw_rect(SelWindow.w) # Update the info text at the top SelWindow.w.delete(SelWindow.text) SelWindow.text = SelWindow.w.create_text( (s.WINDOW_WIDTH / 2, 10), text=str(Boxes.sel) + "selected - O = save output, 1-9 to change box num, T = toggle type, C = clear current box, close window to return to setup" ) if cont: SelWindow.master.after(2000, task) # reschedule event in 2 seconds
def callbackKey(event): key = (event.char) try: # Make an output file if key == 'o': output_coords() # Swap the type of the box if key == 't': Boxes.getCur().swap_type() # Clear the current box if key == 'c': Boxes.getCur().clear() # Switch the setting to a new number i = int(key) if i < 10 and i >= 0: Boxes.setCur(i) print "INFO: Switching to", i except: pass task()
def callbackMouse(event): SelWindow.w.focus_set() Boxes.getCur().update_pos(event.x, event.y) print "INFO: Clicked at", event.x, event.y task()