Python Forum
tkinter destroy label inside labelFrame
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
tkinter destroy label inside labelFrame
#1
hello.I have 3 functions inside a file:

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.
Reply


Messages In This Thread
tkinter destroy label inside labelFrame - by Nick_tkinter - Feb-23-2021, 02:32 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Tkinter: An image and label are not appearing. emont 7 906 Mar-21-2024, 03:00 PM
Last Post: deanhystad
  Using Tkinter inside function not working Ensaimadeta 5 5,228 Dec-03-2023, 01:50 PM
Last Post: deanhystad
  [Tkinter] can i had a cefpython3 to a labelframe razs 25 11,567 Sep-15-2023, 01:38 PM
Last Post: munirashraf9821
  [Tkinter] Help running a loop inside a tkinter frame Konstantin23 3 1,694 Aug-10-2023, 11:41 AM
Last Post: Konstantin23
Exclamation [Tkinter] Error when closing the main window with destroy TomasSanchexx 1 864 Aug-06-2023, 01:54 AM
Last Post: deanhystad
  [Tkinter] Updating Tkinter label using multiprocessing Agusms 6 3,307 Aug-15-2022, 07:10 PM
Last Post: menator01
  [Tkinter] The Text in the Label widget Tkinter cuts off the Long text in the view malmustafa 4 5,231 Jun-26-2022, 06:26 PM
Last Post: menator01
  [Tkinter] _tkinter.TclError: can't invoke "destroy" command: application has been destroyed knoxvilles_joker 6 15,985 Apr-25-2021, 08:41 PM
Last Post: knoxvilles_joker
  [Tkinter] Redirecting all print statements from all functions inside a class to Tkinter Anan 1 2,729 Apr-24-2021, 08:57 AM
Last Post: ndc85430
  Menu destroy Heyjoe 5 3,467 Mar-02-2021, 01:45 AM
Last Post: Heyjoe

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020