'Remove Widget from Tkinter in function
I want to remove the result from lable_result after it packed in root window GUI_calculate.
and here is my code:
def GUI_calculate():
num = number.get()
fact = calculate_factorial(int(num))
lable_result = Label(text=f'Factorial : {num} = {str(fact)}')
lable_result.pack()
root = Tk()
root.geometry('200x200')
root.title('calculate factorial')
# root.configure(background='lightgray')
lable = Label(text='enter number ',font=("Arial", 25))
lable.pack()
number = Entry(width=5)
number.pack()
btn = Button(command=GUI_calculate,text='calc')
btn.pack()
root.mainloop()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
