Watch Intro To Tkinter Playlist FREE Tkinter Widget Book bit.ly/3wwUe21 bit.ly/3K4qlZC See More At: Subscribe To My UA-cam Channel: Tkinter.com bit.ly/3Pk1By4 MASSIVE TKINTER.COM DISCOUNT Join My Facebook Group: 30% off with coupon code: youtube bit.ly/2GFmOBz Get The Code For This Video bit.ly/3dCzz2K
This may be a bit less clumsy for the function. def check_toppings(): toppings = [] if var1.get() == 1: toppings.append('Pepperoni') if var2.get() == 1: toppings.append('Cheese') if var3.get() == 1: toppings.append('Mushrooms') if toppings: my_label.config(text=f"You Picked {', '.join(toppings)}.") else: my_label.config(text='No toppings selected.')
Watch Intro To Tkinter Playlist FREE Tkinter Widget Book
bit.ly/3wwUe21 bit.ly/3K4qlZC
See More At: Subscribe To My UA-cam Channel:
Tkinter.com bit.ly/3Pk1By4
MASSIVE TKINTER.COM DISCOUNT Join My Facebook Group:
30% off with coupon code: youtube bit.ly/2GFmOBz
Get The Code For This Video
bit.ly/3dCzz2K
This may be a bit less clumsy for the function.
def check_toppings():
toppings = []
if var1.get() == 1:
toppings.append('Pepperoni')
if var2.get() == 1:
toppings.append('Cheese')
if var3.get() == 1:
toppings.append('Mushrooms')
if toppings:
my_label.config(text=f"You Picked {', '.join(toppings)}.")
else:
my_label.config(text='No toppings selected.')
nice
A but less repetitive in clicked:
def clicked():
for var, onval in zip((var1,var2,var3), (‘pepperoni’, ‘cheese’, ‘mushroom’):
…
nice