# -*- coding: utf-8 -*- """ Created on Sat Aug 14 11:26:50 2021 @author: russell Using python 3.9.6 on Windows 10, using Spyder IDE """ import tkinter as tk from tkinter import ttk root = tk.Tk() root.title('Test') root.geometry('300x300+5+150') def show1(option): label1['text'] = option def show2(option): label2['text'] = option ttk.Button(root, text='Rock1', command=lambda: show1('Rock1')).pack() ttk.Button(root, text='Paper1',command=lambda: show1('Paper1')).pack() ttk.Button(root, text='Scissors1', command=lambda: show1('Scissors1')).pack() label1 = ttk.Label(root, text='Show1 Label') label1.pack() # this makes label1 able to be referenced ttk.Button(root, text='Rock2', command=lambda: show2('Rock2')).pack() ttk.Button(root, text='Paper2',command=lambda: show2('Paper2')).pack() ttk.Button(root, text='Scissors2', command=lambda: show2('Scissors2')).pack() label2 = ttk.Label(root, text='Show2 Label').pack() # this line leaves label2 with a type of 'NoneType', # thus not able to be referenced or assigned to buttonquit = ttk.Button(root, text = 'Quit', width = 30, command = root.destroy) buttonquit.pack() root.mainloop() print('Test completed')