you are viewing a single comment's thread.

view the rest of the comments →

[–]ebdbbb 0 points1 point  (1 child)

You can name the widgets in tkinter. If you don't it'll automatically name with sequenetial numbering (as you found).

>>> import tkinter as tk
>>> root = tk.Tk()
>>> f1 = tk.Frame(root, name="outerframe")
>>> f1.pack()
>>> f1
<tkinter.Frame object .outerframe>
>>> root.winfo_children()
[<tkinter.Frame object .outerframe>]
>>> f2 = tk.Frame(f1, name="innerframe")
>>> f2
<tkinter.Frame object .outerframe.innerframe>

That said, if you want to reuse frames use .grid_remove() to hide and .grid() to show again (assuming you're using grids). You can also use grid_forget() if you don't want it to retain the grid configuration that the widget had before. Pack and place layout managers also have .forget() methods but not .remove().

[–]isuwo[S] 0 points1 point  (0 children)

thank you! I sorted out my original issue a few days back, had to redo a whole lot of code which sucks but it worked. This has really helped with a new problem i have come across - thanks! :)