Trying to use Treeview in a project but just got hit with an error; module 'tkinter' has no attribute 'Treeview'
Here's my code;
import tkinter as tk
from tkinter import *
import tkinter as ttk
class MainGUI:
def __init__(self, master):
self.master = master
self.EmpInfo = ttk.Treeview(self.master).grid(row = 1 , column = 1)
def main():
root = tk.Tk()
a = MainGUI(root)
root.mainloop()
if __name__ == '__main__':
main()
Do i need to pip install more stuff or am i just using Treeview wrong?
from tkinter import ttk, and thenself.EmpInfo = ttk.Treeview(self.master)import tkinter as ttkisn't doing what you think. It's not importing ttk, it's just importing tkinter and giving it a different name. That won't cause it to have theTreeviewclass.