Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

his is the template in idle form # 3 labels, 3 radiobuttons (as per diagram) # I

ID: 3748346 • Letter: H

Question

his is the template in idle form

# 3 labels, 3 radiobuttons (as per diagram)
# Initially, the Labels are grey and display no text.
# When Radiobutton 1 is selected by the user, the first Label
# changes colour and displays the text "Ready..."
# When Radiobutton 2 is selected by the user, the second Label
# changes colour and displays the text "Set..."
# When Radiobutton 3 is selected by the user, the third Label
# changes colour and displays the text "...GO!"
#----------------------------------------------------------------

# Import the Tkinter functions
from tkinter import *

# Create a window
the_window = Tk()

# Give the window a title
the_window.title('Label Changer')

# PUT YOUR CODE HERE-------------------------------------------------#

# -------------------------------------------------------------------#

# Start the event loop
the_window.mainloop()

Attached is an incomplete Python template file radio_label changer py. Download this file and complete it to solve the following peoblem Conaider the GUI below Label and Radicbuttona) which haz been produced with a Python program using the Tkinter library. Label ChangerX 1 23 Initial GUI Label Changer X Label C hangerX D X Label Changer x Ready Set... GO! 1 2 3 1 2 312 3 GUI after interaction You are required to write a Python progranm to produce this interactive GUL. Your GUI muat replicate the example abore aa closely as poesible, including the eame widgets diaplayed in the sample poeitions on the GUI uaing the eame colours, shapea and relative sizea. (Note that the GUI border in the eample output does not need to be replicated aa this is an operating syetem environment Betting)

Explanation / Answer

# 3 labels, 3 radiobuttons (as per diagram) # Initially, the Labels are grey and display no text. # When Radiobutton 1 is selected by the user, the first Label # changes colour and displays the text "Ready..." # When Radiobutton 2 is selected by the user, the second Label # changes colour and displays the text "Set..." # When Radiobutton 3 is selected by the user, the third Label # changes colour and displays the text "...GO!" #---------------------------------------------------------------- # Import the Tkinter functions from tkinter import * def update(): x=val.get() #Taking appropriate action based on Radio Button selected rest of the code in this function in self explanatory if(x==1): a.config(text="Ready...",bg="red",font=('Helvetica','20')) b.config(text="",bg='gray') c.config(text="",bg='gray') if(x==2): b.config(text='Set...',bg="orange",font=('Helvetica','20')) a.config(text="",bg='gray') c.config(text="",bg='gray') if(x==3): c.config(text='...GO!',bg='green',font=('Helvetica','20')) b.config(text="",bg='gray') a.config(text="",bg='gray') # Create a window the_window = Tk() # Give the window a title the_window.title('Label Changer') #Setting up Labels on to the window a=Label(the_window,text="",padx=200,pady=30,bg="gray",relief="raised") a.grid(row=0,column=0,padx=10,pady=10) a.grid_propagate(False) b=Label(the_window,text="",padx=200,pady=30,bg="gray",relief="raised") b.grid(row=1,column=0,padx=10,pady=10) c=Label(the_window,text="",padx=200,pady=30,bg="gray",relief="raised") c.grid(row=2,column=0,padx=10,pady=10) #Intializing dictionary to assign values to radio buttons d1={1:'1',2:'2',3:'3'} val=IntVar() #Setting up radio buttons #Update function is written to perform appropriate action on radio button selection for i in d1: r=Radiobutton(the_window,text=d1[i],variable=val,value=i,command=update,font="10") r.grid(row=3,column=i) # Start the event loop the_window.mainloop()

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote