How do I create a function that makes a window with two buttons, where each button has a specified string and, if clicked on, returns a specified variable? Similar to @ 3:05 in
tkinter is a GUI Library, this code creates simple no-text buttons:
import tkinter as tk
class Callback:
def __init__(self, color):
self.color = color
def changeColor(self):
print('turn', self.color)
c1 = Callback('blue')
c2 = Callback('yellow')
B1 = tk.Button(command=c1.changeColor)
B2 = tk.Button(command=c2.changeColor)
B1.pack()
B2.pack()