Tkinter Treeview (Python): более быстрый способ получить детей, детей детей и т. Д. c? - PullRequest
0 голосов
/ 02 мая 2020

Мой мозг, должно быть, не работает. Я хочу получить всех детей / внуков / et c из дерева. Есть ли лучший способ, чем следующие вложенные циклы с несколькими пропущенными строками кода?

def get_full_children(tv, selection):
    for a in selection:
        selection += tv.get_children(a)
        for b in tv.get_children(a):
            selection += tv.get_children(b)
            for c in tv.get_children(b):
                selection += tv.get_children(c)
                for d in tv.get_children(c):
                    selection += tv.get_children(d)
                    for e in tv.get_children(d):
                        selection += tv.get_children(e)
                        for f in tv.get_children(e):
                            selection += tv.get_children(f)
                            for g in tv.get_children(f):
                                selection += tv.get_children(g)
                                for h in tv.get_children(g):
                                    selection += tv.get_children(h)
                                    for i in tv.get_children(h):
                                        selection += tv.get_children(i)
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...