Closed Nigacatch closed 6 months ago
Here is an example for the page implementation in ctktable,
import customtkinter
from CTkTable import *
def change_left():
global current_page
current_page -= 4 # move 4 rows backward
table.update_values(values[current_page-4:current_page])
pass
def change_right():
global current_page
current_page += 4 # move 4 rows forward
table.update_values(values[current_page-4:current_page])
pass
root = customtkinter.CTk()
current_page = 0
# Make a long list
values = []
start = 0
end = 5
for i in range(20):
values.append(list(range(start, end)))
start = end
end += 5
table = CTkTable(master=root, row=4, column=5)
table.pack(expand=True, fill="both", padx=20, pady=20)
customtkinter.CTkButton(root, text="<", width=40, command=change_left).pack(side="left", expand=True, pady=10)
customtkinter.CTkButton(root, text=">", width=40, command=change_right).pack(side="right", expand=True, pady=10)
change_right()
root.mainloop()
header: Hello, first of all, you need to take a look at this post: https://github.com/TomSchimansky/CustomTkinter/discussions/431#discussioncomment-7739561
body: As it was explained, when the number of our records is large, for example a thousand... the use of the program is not optimal and it is slow. I thought to solve this problem and that is that we should not show all the items at the same time and it is better to show 10 items at a time and design pages based on the number of records and move between pages. For example, our 1000 records are divided into 100 pages, each of which displays 10 records. I think that problem will be solved in this case. I wanted to get your help on how I can implement this idea? thank you