Python Forum
Hardest time getting DataFrame to populate Tree Widget
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Hardest time getting DataFrame to populate Tree Widget
#1
I am very new to any GUI coding. I chose to work with Tkinter instead of PyQt. I have the basics down as far as the foundation of the GUI and have begun to make each separate frame. One of these frames will be for viewing generated invoices. The problem that I am encounter though is populating the data to the correct layout. I have data populated in the tree widget currently, but it is complete messed up. I have attached an image below. Here is the code I am currently working with. It's not a lot, I just can't figure out for the life of me what changes I need to make.

   

imp_df = pd.read_csv(r"V:\Invoices\Test Invoices.csv")

class ViewDataFrame(tk.Frame):


    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)

        tk_table = ttk.Treeview(self, columns=imp_df.columns.values)

        tk_table.heading('#0', text='Invoice Number')
        tk_table.heading('#1', text='Invoice Date')
        tk_table.heading('#2', text='Description')
        tk_table.heading('#3', text='Quantity')
        tk_table.heading('#4', text='Class')
        tk_table.heading('#5', text='Job')
        tk_table.heading('#6', text='Terms')
        tk_table.heading('#7', text='Items')
        tk_table.heading('#8', text='Amount')
        tk_table.heading('#9', text='PO Number')
        tk_table.heading('#10', text='Memo')
        tk_table.heading('#11', text='IsToEmail')

        def list_df():
            for each_rec in range(len(imp_df)):
                tk_table.insert("", tk.END, values=imp_df.loc[each_rec])
Reply


Messages In This Thread
Hardest time getting DataFrame to populate Tree Widget - by WuchaDoin - Oct-15-2018, 06:45 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyQt] populate a QListWidget devilonline 1 1,669 Apr-10-2023, 02:52 AM
Last Post: deanhystad
  [PyQt] [Solved]Populate ComboBox with for loop? Extra 3 2,221 Jul-31-2022, 09:01 PM
Last Post: Extra
  Problems getting tk Combobox contents to populate properly dford 4 3,945 Jan-08-2022, 02:39 PM
Last Post: dford
  Auto populate dictionary with names/values of QT widgets cjh 1 3,026 Mar-23-2021, 02:56 PM
Last Post: deanhystad
  [PyQt] How to populate a treeview on a GUI with a dictionary mart79 1 8,357 Aug-05-2019, 01:30 PM
Last Post: Denni
  populate list with images and be able to select them ricardons 0 2,167 Jan-11-2019, 03:45 PM
Last Post: ricardons

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020