def run(): colours = ["red", "green", "blue", "yellow", "orange", "pink"] guesses = [] number_of_positions = 4 permutation_iterator = all_colours(colours, number_of_positions) current_colour_choices = next(permutation_iterator) new_guess = (current_colour_choices, (0, 0)) row_offset = 1 root = Tk() root.title("Mastermind") root["padx"] = 30 root["pady"] = 20 entryLabel = Label(root) entryLabel["text"] = "Completely Correct:" entryLabel.grid(row=row_offset, sticky=E, padx=5, column=number_of_positions + 4) entryWidget_both = Entry(root) entryWidget_both["width"] = 5 entryWidget_both.grid(row=row_offset, column=number_of_positions + 5) entryLabel = Label(root) entryLabel["text"] = "Wrong Position:" entryLabel.grid(row=row_offset + 1, sticky=E, padx=5, column=number_of_positions + 4) entryWidget_only_colours = Entry(root) entryWidget_only_colours["width"] = 5 entryWidget_only_colours.grid(row=row_offset + 1, column=number_of_positions + 5) submit_button = Button(root, text="Submit", command=new_evaluation_tk) submit_button.grid(row=4, column=number_of_positions + 4) quit_button = Button(root, text="Quit", command=root.quit) quit_button.grid(row=4, column=number_of_positions + 5) show_current_guess(current_colour_choices) root.mainloop()
print(guessed_colours[col_count]) l = Label(root, text=" ", bg=guessed_colours[col_count]) l.grid(row=row, column=col_count, sticky=W, padx=2) col_count += 1 # evaluation: for i in (0, 1): l = Label(root, text=str(guess[1][i])) l.grid(row=row, column=col_count + i + 1, padx=2) if __name__ == "__main__": colours = ["red", "green", "blue", "yellow", "orange", "pink"] guesses = [] number_of_positions = 4 permutation_iterator = all_colours(colours, number_of_positions) current_colour_choices = next(permutation_iterator) new_guess = (current_colour_choices, (0, 0)) row_offset = 1 root = Tk() root.title("Mastermind") root["padx"] = 30 root["pady"] = 20 entryLabel = Label(root) entryLabel["text"] = "Completely Correct:" entryLabel.grid(row=row_offset, sticky=E, padx=5,
l = Label(root, text=" ", bg=guessed_colours[col_count]) l.grid(row=row,column=col_count, sticky=W, padx=2) col_count += 1 # evaluation: for i in (0,1): l = Label(root, text=str(guess[1][i])) l.grid(row=row,column=col_count + i + 1, padx=2) if __name__ == "__main__": colours = ["red","green","blue","yellow","orange","pink"] guesses = [] number_of_positions = 4 permutation_iterator = all_colours(colours, number_of_positions) current_colour_choices = next(permutation_iterator) new_guess = (current_colour_choices, (0,0) ) row_offset = 1 root = Tk() root.title("Mastermind") root["padx"] = 30 root["pady"] = 20 entryLabel = Label(root) entryLabel["text"] = "Completely Correct:" entryLabel.grid(row=row_offset, sticky=E, padx=5,