0

Im trying to update table2 when new cell in table1 is selected.

first I bind table1 left mouse click as follow:

proj.pt_table1.bind('<ButtonRelease-1>',lambda e: update_table2(e, table2frame, proj))

then update_table2 function handling the table2 update.

def update_table2(e, table2frame, proj):
    proj.table2 = Table(table2frame,dataframe=my_table,width=1200, height=300)
    proj.table2.show()

At first, the code works as expected, but if I click too fast the pandastable become blank. blank table

regular table

Hi, Im trying to update table2 when new cell in table1 is selected.

Guy Barda
  • 11
  • 3
  • Great question. `click too fast` caught my attention: is there a way to add a protection. Parameter `my_table` is unclear, where is it coming from? Also, is this not related to the speed between website and DB? Also, I would avoid showing inside the function (experience from pyspark: show AFTER result): this also allows some validation after the result is returned, like number of rows > 0, etc. Also, can you catch an Exception? – Curious Watcher Apr 19 '23 at 14:31
  • Thanks for your response, When I evaluate the df it seems like all data exist, but when I try to show it using - proj.table2.show() the table seems blank. The variable my_table was defined earlier its type of lableframe. im trying to catch an Exceptation with no success because its feels like df works well but visually it doesn't looks good – Guy Barda Apr 20 '23 at 05:13
  • Sounds like a conflict between table2 and my_table during assignment. Objects should not change inbetween. I also remember that for pandas dataframes a copy of df had to be created in some cases, please check – Curious Watcher Apr 20 '23 at 16:37
  • Can you please explain how param `my_table` is used in function `update_table2`, because atm I do not understand where it is passed to this function? – Curious Watcher Apr 20 '23 at 16:57

0 Answers0