def Unbind(x, y): global to_run global buttons lp_events.unbind(x, y) # Clear any events associated with the button btn = Button(x, y, "") # create the new blank button if (x, y) in [l[1:] for l in to_run]: # If this button is scheduled to run... indexes = [ i for i, v in enumerate(to_run) if ((v[1] == x) and (v[2] == y)) ] #... create a list of locations in the list for this button for index in indexes[::-1]: # and for each of them (in reverse order) temp = to_run.pop(index) # Remove them from the list buttons[x][y] = btn # Clear the button script #return # WHY do we return here? if btn.thread != None: # If the button is actially executing thread.kill.set() # then kill it buttons[x][y] = btn # Clear the button script files.layout_changed_since_load = True # Mark the layout as changed Redraw(x, y)
def unbind(x, y): global to_run lp_events.unbind(x, y) text[x][y] = "" if (x, y) in [l[1:] for l in to_run]: indexes = [i for i, v in enumerate(to_run) if ((v[1] == x) and (v[2] == y))] for index in indexes[::-1]: temp = to_run.pop(index) return if threads[x][y] != None: threads[x][y].kill.set() files.layout_changed_since_load = True