I have a pandastable that displays in my tkinter GUI.
Using the value from the tkinter option menu, value = Status.get() I would like to select a particular cell in my pandastable and use the value from value = Status.get() to append the cell.
I know how I can append a value to a dataframe using set_value() within a function but Im not sure on how I can return the position of the selected cell using pandastable? Or if its possible?
I have played with tkinter treeview widget and you can return selected cell position with .focus()
I have been referencing methods using the doc: https://pandastable.readthedocs.io/en/latest/_modules/pandastable/core.html#Table.get_col_clicked
But I cant find anything to fit my purpose...
See below the screenshot of my pandastable the Column Current Status row 2 position has been double clicked. I want to return this position.
root = tk.Tk()
root.geometry("2000x1000")
root.title('Workshop Manager')
def select_input_file():
global df, app
input_file_path = filedialog.askopenfilename(filetypes=(("CSV files", "*.csv"),))
app = TestApp(root, input_file_path)
app.place(bordermode=INSIDE, height=500, width=2000, x=0, y=50)
df = app.table.model.df
class TestApp(tk.Frame):
def __init__(self, parent, input_file_path, editable = True, enable_menus = False):
super().__init__(parent)
self.table = Table(self, showtoolbar=False, showstatusbar=False)
self.table.importCSV(input_file_path)
self.table.show(input_file_path)
self.table.addColumn('Current Status')
self.table.addColumn('Assign Technician')
self.table.autoResizeColumns()
def set_cell():
row = app.table.getSelectedRow()
col = app.table.getSelectedColumn()
app.table.model.setValueAt(Status.get(), row, col)
app.table.redraw()
StatusList = [
"Carry Over",
"Waiting On Parts",
"Waiting On Car Wash",
"Yet to Arrive",
"Not Started",
"Being Worked On",
]
Status = StringVar()
Status.set(0)
drop=tk.OptionMenu(root, Status, "Select Status", *StatusList, command = set_cell())
drop.place(x=1440, y=0, height=50, width=150)
root.mainloop()
