btn = ttk.Button(root, text="Load CSV", command=self.load_csv) btn.pack()
def load_csv(self): filepath = filedialog.askopenfilename(filetypes=[("CSV files", "*.csv")]) if filepath: df = pd.read_csv(filepath) self.tree.delete(*self.tree.get_children()) self.tree["columns"] = list(df.columns) self.tree["show"] = "headings" for col in df.columns: self.tree.heading(col, text=col) for _, row in df.iterrows(): self.tree.insert("", tk.END, values=list(row)) messagebox.showinfo("Success", f"Loaded len(df) rows") if == " main ": root = tk.Tk() app = CSVViewer(root) root.mainloop() Bottom Line: If you want to turn Python scripts into double-clickable, shareable desktop applications with minimal dependencies, this course is one of the most practical and affordable ways to master Tkinter. Udemy - Ultimate Tkinter Python GUI Masterclass