Hello friends how can I update the window in tksheet. I have a database.Which connects to Postgresql and pulls out data. In addition, I can choose the date of the data, from which to which.After starting, I select the dates and click on the "Get data" button.The first time is displayed. After the first time, the data is not output to the interface.But it is displayed in the console. You can't select the date a second time and display it on the interface. I think that you need to update the window, if so, as soon as possible.
def sec_frame(self):
global date_from1, date_from2
sec_frame1 = Frame(self.master, background='#21acfc', )
sec_frame1.pack()
query_button = tk.Button(sec_frame1, text='Get data', width=200, command=self.get_datas)
query_button.pack(side=LEFT, padx=50, pady=40)
date_from1 = DateEntry(sec_frame1, background='#e03aca', font="Helvetica 14", locale='KY')
date_from1.pack(side=LEFT, padx=50)
date_from2 = DateEntry(sec_frame1, background='#e03aca', font="Helvetica 14",locale='KY')
date_from2.pack(side=LEFT)
def get_datas(self):
date1 = date_from.get_date()
date2 = date_to.get_date()
query_datas= f"select *from client_info where date_to='{date1}'::date and date_from='{date2}'::date"
self.cursor.execute(query_datas)
get_datas = self.cursor.fetchall()
print(get_datas) #I actually get the data in the console
try:
get_datas[0]
except IndexError:
messagebox.showerror('some text', 'some text')
lenn = len(get_datas)
len1 = len(get_datas[0])
bottom_frame = Frame(self.master, )
table = Sheet(bottom_frame, page_up_down_select_row=True, column_width=120, startup_select=(0, 1, "rows"),
data=[[get_datas[r][c] for c in range(len1)] for r in range(lenn)],
height=1000,
width=1920
)
table.enable_bindings(("single_select",
"drag_select",
"column_drag_and_drop",
"row_drag_and_drop",
"column_select",
"row_select",
"column_width_resize",
"double_click_column_resize",
"arrowkeys",
"row_height_resize",
"double_click_row_resize",
"right_click_popup_menu",
"rc_select",
"rc_insert_column",
"rc_delete_column",
"rc_insert_row",
"rc_delete_row",
"hide_columns",
"copy",
))
bottom_frame.pack()
table.pack(side=TOP)