Reputation: 582
I am new to python development and am currently building a gui using tkinter.
My button works as expected when clicked, opens another window displays face bounding boxes, however when I close the faces window and return to the buttons main window, the button still displays as clicked (pressed/sunken) and I cannot click any other buttons or close the window.
How do I release the button after it is clicked?
def btn1():
os.system("python App.py group.jpg")
button1 = Button(window, text = "Button 1", command=btn1).grid(row=0, column=0)
Upvotes: 0
Views: 733
Reputation: 582
(SOLUTION) I discovered that the last line of the App.py script was: cv2.waitKey(0) The user must hit "Enter" in-order for the commmand/waitKey to terminate. Closing the window using the 'X' on the window toolbar, does close the window but does not terminate the command and leaves the button in a pressed-state.
I have amended this value to specific time parameter 2500 i.e. 2500 milliseconds so no user involvement is required. Although as stated, simply pressing 'enter/return' terminates the command and releases the button.
To confirm, this works for both os.system and subprocess.
Hope this helps save others sometime, and thanks to everyone for your help.
Upvotes: 2