Hello everyone, could you please give me some suggestion on how I can pass the values from os to tkinter in the case below?
I use the tree a lot with pyodbc but I am kind of stuck using the file system result. The error is:
tree.pack(expand=True, fill='y')
^
SyntaxError: invalid syntax
Process finished with exit code 1
Many Thanks, I hope I can reply the favor in some SQL forum.
Resolved, a simple missing bracket.
from tkinter import * from tkinter import ttk import os master = Tk() master.geometry("800x800") master.configure(background='#3c485f') tree = ttk.Treeview(master) tree["columns"] = ("one", "two") tree.column("one", width=100) tree.column("two", width=100) tree.heading("one", text="DataBaseName") tree.heading("two", text="FileGroup") # pick a folder you have ... folder = 'Y:' folder_size = 0 for (path, dirs, files) in os.walk(folder): for file in files: filename = os.path.join(path, file) folder_size += os.path.getsize(filename) tree.insert("", 0, text="Normal", values=(filename,(folder_size/(1024*1024.0)),folder_size) tree.pack(expand=True, fill='y')
I use the tree a lot with pyodbc but I am kind of stuck using the file system result. The error is:
tree.pack(expand=True, fill='y')
^
SyntaxError: invalid syntax
Process finished with exit code 1
Many Thanks, I hope I can reply the favor in some SQL forum.
Resolved, a simple missing bracket.