Feb-20-2018, 08:00 PM
This doesn't answer your question, but seeing the path you've taken so far makes me want to help with something else. When you see large chunks of code that are identical in *almost* every way, you can normally write a single function that handles both cases. In this instance, one function instead of 28:
from tkinter import * result = [] def add_to_result(value): result.append(value) def clear_results(): result = [] def handler(value): return lambda: add_to_results(value) root = Tk() characters = 'abcdefghijklmnopqrstuvwxyz' for char in characters: btn = Button(root, command=handler(char)) photo = PhotoImage(file="Symbols/{0}.png".format(char)) btn.config(image=photo) btn.pack()