def addappendbutton(): """ Creates a button that allows the user to add to the dance…
- User
def add_append_button(): """ Creates a button that allows the user to add to the dance moves list """ add_back = codesters.Rectangle(-180, -210, 100, 50, "green") add_text = codesters.Text("Add Move", -180, -210, "white")
codedef click(sprite): global dance_moves user_choice = sprite.ask("What dance move would you like to add to the end?") dance_moves.append(user_choice) update_displays() add_back.event_click(click)def add_delete_button(): """ Creates a button that deletes a move from the list """ delete_back = codesters.Rectangle(-60, -210, 125, 50, "red") delete_text = codesters.Text("Delete Move", -60, -210, "white")
codedef click(sprite): global dance_moves user_choice = int(sprite.ask("At what position do you want to delete a dance move?")) del dance_moves[user_choice:user_choice+1] update_displays() delete_back.event_click(click)def add_insert_button(): """ Creates a button that inserts a move at a specific position inside the list """ insert_back = codesters.Rectangle(70, -210, 120, 50, "orange") insert_text = codesters.Text("Insert Move", 70, -210, "white")
codedef click(sprite): global dance_moves position = int(sprite.ask("At what position do you want to insert a dance move?")) move = sprite.ask("And what dance move would you like to add?") dance_moves.insert(position, move) update_displays() insert_back.event_click(click)def add_dance_button(sprite): """ Creates a button that starts the dance """ play_back = codesters.Rectangle(180, -210, 75, 50, "white") play_text = codesters.Text("Dance!", 180, -210, "green")
codedef click(sprite): global dance_moves for move in dance_moves: if move == "up": sprite.move_up(50) if move == "down": sprite.move_down(50) if move == "right": sprite.move_right(50) if move == "left": sprite.move_left(50) sprite.go_to(0, -75) play_back.event_click(click) - Assistant
- User
with spaces
- Assistant
- User
why is there a white square?
- Assistant