Tree tk (file explorer)
<p>i would like to create a file explorer but m having some trouble with the id = tree.insert()                                                          </p>

<pre><code>def SUBS(path):
    PO   = ""
    parent = tree.parent(XOM)
    while os.path.exists(path+"/"+PO):
          X1   = 0
          List = os.listdir(path+"/"+PO)
          for element in List:
              X1 += 1
              if os.path.isfile(path+"/"+element):
                 tree.insert(XOM,str(X1),text=element)
              if os.path.isdir(path+"/"+element):
                 id = tree.insert(XOM,str(X1),text=element)
                 PO = element
          break
X    = 0
Path = "/"
WinT = Tk()
tree = ttk.Treeview(WinT ,height=15)
tree.pack(expand=YES,fill=BOTH)
tree.heading("#0" ,text="Directory")

PATH = os.listdir(Path)
for element in PATH:
    X  += 1
    PaTh = Path+"/"+element
    if "//" in PaTh:
       PATH = PaTh.replace('//','/')
    if "//" not in PaTh:
       PATH = PaTh
    if "." in element :
       tree.insert('',str(X),text=element)
    if "." not in element:
       XOM = tree.insert('',str(X),text=element)
       SUBS(PATH)
</code></pre>

<p>so the problem is the function SUBS() the problem s actually coming from the fact that m using id = at the beginning it should only be used through the function SUBS() otherwise id already exist and it can't work ..         i would like to use id = instead of X = in SUBS() but i can't ..</p>