I want to create Python GUI for desktop app. I designed this with Tkinter:
Two buttons are used to execute commands and exit the app, Button one
is proceed to the code and Button two
is for exit. But the GUI is not responding.
when executing the process Pressing button two
does not exit the app, and pressing button 1
does not trigger the code in the function def clicked()
.
Is there any better method to exit even while running the program (like interrupts maybe?)
In Tkinter can we pass the value without pressing the button. (process is repeating but i need to press only one button press, need to execute automatically while showing the GUI)
def GUI():
window =Tk()
window.title("Select First Color")
selected = IntVar()
rad1 = Radiobutton(window, text='RED', value=1, variable=selected)
rad2 = Radiobutton(window, text='YELLOW', value=2, variable=selected)
def clicked():
# Go to a function according to the selection of radio button
button1 = Button(window, text="Select", command=clicked)
button2 = Button(window, text="Quit", command=window.destroy)
rad1.grid(column=0, row=0) # GUI RadioButton Placement
rad2.grid(column=1, row=0)
button1.grid(column=6, row=0) # GUI Button Placement
button2.grid(column=6, row=1)
window.mainloop()