I have an application that displays real-time data in a pandastable inside of a Tkinter application.
When the data updates, so does the table. However, I added some code so that after an update it automatically shows the final rows in the table.
When the data updates, the table does not render correctly. It shows one empty row. However, as soon as I scroll the table, all the rows suddenly appear.
I can not use df.tail because then I can not see the rows above the specified tail.
Here is the table after updating:

Here is the table after scrolling:

Here is the function. Since adding the final 2 lines I have had this issue. Without those 2 lines, the table updates and then renders correctly. However, it always starts at row 1, when I want the final row to be displayed (hence the 2 new lines of code).
def display_data(self, dataframe):
if dataframe is None or dataframe.empty:
print("No dataframe to display or dataframe is empty.")
return # Exit the function early if there's no dataframe or it's empty
for widget in self.table_frame.winfo_children():
widget.destroy()
self.table = Table(self.table_frame, dataframe=dataframe, showtoolbar=False, showstatusbar=True, height=400, width=800)
self.table.autoResizeColumns()
self.table.show()
self.table.redraw()
# Find the last row index
last_row_index = len(dataframe) - 1
# Scroll to the last row
self.table.movetoSelection(row=last_row_index) # Assuming you want to scroll to the first column as well
Maybe try to use
afterto wait the full rendering of your table :Also consider threading the whole process to prevent freezing GUI