I wanted to know if there is a simple way to get all the toplevels from a specific window, including toplevels within toplevels. In the following code I leave an example of what I want to do:
from tkinter import Tk, Toplevel
v = Tk()
v2 = Toplevel(v)
v3 = Toplevel(v2)
v4 = Toplevel(v2)
def toplevels(ventana):
print("Here I return the list of all toplevels, in case of choosing the main window, it should return:")
print()
print(".")
print(".toplevel")
print(".toplevel.toplevel")
print(".toplevel.toplevel2")
toplevels(v)
Is there something built into Tkinter to accomplish this?
append()every Toplevel to this list.all_toplevels.append(v)- furaswinfo_children) does not return all toplevels, only the toplevels associated with the window. For examplev.winfo_children ()will return only tov2, notv3andv4. - Dante S.