Feb-23-2021, 02:32 PM
hello.I have 3 functions inside a file:
My program is bigger and different that this one I show you.I make it smaller and a little bit different to make it easier to understand.
Thanks.
import webbrowser from tkinter import * from datetime import datetime def open_google_maps(root , label_frame , see_info): show_message = Label(label_frame , text = str(datetime.now().strftime("%H:%M:%S")) + " " * 4 + "Google maps link has opened") if(see_info): maps_URL = "https://www.google.com/maps/" browser = webbrowser.get("chromium") browser.open(maps_URL) show_message.place(x = 0 , y = 60) else: show_message.destroy() def clear_labels(root , label_frame): open_google_maps(root , label_frame , False)In another file I have this function:
def control_window(root): operation_info = LabelFrame(root , width = 400 , height = 100) operation_info.place(x = 1105 , y = 100) Label(operation_info , text = "Time " + "Operation").place(x = 0 , y = 0) clear_operation_button = Button(root , text = "Clear all" , width = 5 , height = 5 , command = lambda: clear_labels(root , operation_info)) clear_operation_button.place(x = 1035 , y = 100) open_google_button = Button(root , text = "GOOGLE MAPS" , width = 15 , height = 2 , command = lambda: open_google_maps(root , operation_info , True) ) open_google_button.place(x = 20 , y = 85)and it is called by another function like this:
root = Tk() root.geometry("1500x1500") control_window(root) root.mainloop()My problem is that when I click google maps button ,it shows some text in the labelFrame.So when I click clear all button I want to destroy this label(not labelFrame) ,but it doesn't destroy.How can I fix it?
My program is bigger and different that this one I show you.I make it smaller and a little bit different to make it easier to understand.
Thanks.