I am doing app where I get different time zones by the input and then it is displayed on that window of mine, I can stack as many time zones as I would like in one window, however when I made this function I don't get any error messages, as well button CLEAR does not do anything.
The first function result()
works great.
The function clear_button()
does not do anything, I tried using global variables, and defining label outside of function and nothing worked.
I also tried using lambda within button widget itself, instead of passing a function to use destroy() method for result_label without success.
result_label = tk.Label(time_frame, text=world_times())
def result():
global result_label
result_label = tk.Label(time_frame, text=world_times())
result_label.pack()
def clear_button():
global result_label
result_label = tk.Label(time_frame, text=world_times())
result_label.destroy()
btn_accept = tk.Button(time_frame, text='Accept', command=result)
btn_accept.pack(side=RIGHT, anchor='ne')
btn_clear = tk.Button(time_frame, text='Clear', command=clear_button)
btn_clear.pack(side=RIGHT, anchor='ne')