0

I am building a GUI in python for a first time for which I am using tkinter. In one of my frames I am showing a pandas dataframe using ttk treeview. I would like to make one of the dataframe's columns editable in the GUI. I have been reading and I came across a way of doing it with pop ups but this is not what I want. Is there a way to create directly editable column in tkinter using treeview or any other module. The set up for my current dataframe is below.

    self.tree =ttk.Treeview(self.Frame3,show='headings')

    self.vsb = ttk.Scrollbar(orient="vertical",
                        command=self.tree.yview)
    self.hsb = ttk.Scrollbar(orient="horizontal",
                        command=self.tree.xview)
    self.tree.configure(yscrollcommand=self.vsb.set,
                        xscrollcommand=self.hsb.set)

    for i in columns:
                self.tree.column(i,anchor='c',stretch=True,width=col_width)
                self.tree.heading(i,text=i,anchor='c')
    for index,row in self.final_df.iterrows():
                self.tree.insert("",'end',text=index,values=list(row),tags=tag)
VSP
  • 359
  • 3
  • 14
  • 1
    ***"a way to create directly editable column in `tkinter.Treeview`"***: No – stovfl Feb 11 '20 at 10:14
  • 1
    Consider this approach using [Grid Layout](https://stackoverflow.com/a/58219385/7414759) – stovfl Feb 11 '20 at 10:24
  • 1
    This [link](https://stackoverflow.com/questions/18562123/how-to-make-ttk-treeviews-rows-editable) may be helpful. – acw1668 Feb 11 '20 at 12:13
  • 1
    You can try to use [tkintertable](https://github.com/dmnfarrell/tkintertable/wiki/Example-Code). It is a module to get an excel like table. – j_4321 Feb 12 '20 at 13:02
  • thank you all very much! the link by acw1668 gave me the idea not to use treeview for the dataframe but instead the column i want to be editable to be made up of entry fields, and the values in the columns to be fed in as labels.It does not look as nice as treeview dataframe but does the job. – VSP Feb 13 '20 at 17:18

0 Answers0