def add_row(): global add_button global subtract_button global json_file row = 2 + len(json_file["profile"]) x = 8 coords = [] for coord in range(0, 2): entry = TextBox(box2, coord, grid=[x, row]) entry.when_left_button_released = text_click entry.bg = "white" coords.append(entry) x += 1 row += 1 add_button.destroy() subtract_button.destroy() add_button = PushButton(box2, text="+", grid=[8, row], command=add_row) add_button.bg = "white" subtract_button = PushButton(box2, text="-", grid=[9, row], command=subtract_row) subtract_button.bg = "white" json_file["profile"].append(coords)
def copy(): copy_window = Window(json_editor_window, title="create a copy") copy_window.show(wait=True) Text(copy_window, text="Name of copy :") file_name = TextBox(copy_window, text=file_display.value, enabled=True, width="fill") file_name.when_left_button_released = text_click def complete_copy(): destination = file_name.value save(0, destination) copy_window.destroy() ok_button = PushButton(copy_window, text="OK", command=complete_copy) cancel_button = PushButton(copy_window, text="cancel", command=copy_window.destroy)