Python Forum
make widgets disappear from tkinter
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
make widgets disappear from tkinter
#1
hello
i am writing a workout tracker app. i have the option of adding rows of information to save multiple workout data at the same time. i accomplish that with the following code

globals()[f'day_lbl{self.count}'] = Label(text="On")
        globals()[f"day_value_inside{self.count}"] = StringVar(window, value=self.day_value_inside0.get())
        globals()[f"day_opt{self.count}"] = OptionMenu(window, globals()[f"day_value_inside{self.count}"],
                                                       self.updated_list[0],
                                                       self.updated_list[1], self.updated_list[2], self.updated_list[3],
                                                       self.updated_list[4],self.updated_list[5],self.updated_list[6],self.updated_list[7],self.updated_list[8],self.updated_list[9],self.updated_list[10])
        globals()[f"day_opt{self.count}"].grid(row=self.cur_row, column=1)

        globals()[f'lbl{self.count}'] = Label(text="I did")
        globals()[f"lbl{self.count}"].grid(row=self.cur_row, column=2)
        globals()[f"act_value_inside{self.count}"] = StringVar(window, value="Aerobics")
        globals()[f"act_opt{self.count}"] = OptionMenu(window, globals()[f"act_value_inside{self.count}"], "Aerobics",
                                                       "Cycling",
                                                       "Running", "Swimming", "Walking")
        globals()[f"act_opt{self.count}"].grid(row=self.cur_row, column=3)
        globals()[f"unit_lbl{self.count}"] = Label(text="for: ")
        globals()[f"unit_lbl{self.count}"].grid(row=self.cur_row, column=4)

        globals()[f"unit_ent{self.count}"] = Entry()
        globals()[f"unit_ent{self.count}"].grid(row=self.cur_row, column=5)
        globals()[f"min_lbl{self.count}"] = Label(text="minutes")
        globals()[f"min_lbl{self.count}"].grid(row=self.cur_row, column=6)
        
i want to add the option to get rid of a row of data. as you can see i use the .grid function to place the widgets according to my design. is there a way of removing either the selected row of data or the last one?
Reply


Messages In This Thread
make widgets disappear from tkinter - by jacksfrustration - Jan-30-2024, 07:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Why I am getting ModuleNotFoundError when I make an Exe file for tkinter GUI? pymn 0 1,678 Apr-01-2022, 05:36 PM
Last Post: pymn
  [Tkinter] It it possible to make a help file explorer with tkinter? Clunk_Head 0 2,024 Aug-07-2021, 06:02 PM
Last Post: Clunk_Head
  .get() from generated Entry widgets in tkinter snakes 4 4,301 May-03-2021, 11:26 PM
Last Post: snakes
  [Tkinter] tkinter.Menu – How to make text-variable? Sir 3 5,700 Mar-10-2021, 04:21 PM
Last Post: Sir
  Tkinter Python: How to make sure tkSimpleDialog takes in No value entered rcmanu95 3 2,376 Aug-05-2020, 05:32 AM
Last Post: Yoriz
  How to make button text bold in Tkinter? scratchmyhead 2 12,196 May-16-2020, 02:53 AM
Last Post: scratchmyhead
  Using Tkinter widgets on child window chewy1418 8 7,342 Feb-27-2020, 10:34 PM
Last Post: Marbelous
  Make Label Text background (default color) transparent using tkinter in python barry76 1 24,021 Nov-28-2019, 10:19 AM
Last Post: Larz60+
  Tkinter - Make changes to graph and update it adriancovaci 0 6,639 Apr-08-2019, 09:02 AM
Last Post: adriancovaci
  [Tkinter] Multiple frames with tkinter - How to make them run on fullscreen mode eabs86 3 18,325 Sep-20-2018, 01:27 AM
Last Post: eabs86

Forum Jump:

User Panel Messages

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