You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Making a saving/displaying bookmarks feature for an app.
Bookmarks themselves are CTkFrames which are dynamically created/destroyed depending on user input. They are stored in a CTkScrollableFrame.
Right now when opening "bookmarks" menu, app loads all of them at once. This is not a problem with only a few widgets, but starts significantly impacting performance and load times with 50,100 or more widgets.
At this point I see 2 solutions:
Load bookmarks in batches: show first batch immediately, load the rest in background.
Implement lazy loading: load and show only what can be visible to the user.
Problem with the first one is it will eventually load all of the widgets, and if there is a lot of them it will tank the performance.
So second it is.
I couldn't find a way to check what widgets are currently visible (on screen) — if there is a way to actually get the only visible widgets, please let me know.
So without that right now my idea is:
get current height of the CTkScrollableFrame
get current position in the CTkScrollableFrame (it is "y" in the "Configure" event of CTkScrollableFrame)
get height of individual bookmark (their size is fixed for me)
grid/destroy bookmarks depending on the current position
simulate height of destroyed bookmarks with placeholder frames(? idk) so CTkScrollableFrame doesn't collapse onto them
It feels like there should be a better way to do this, I'm missing something
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Making a saving/displaying bookmarks feature for an app.
Bookmarks themselves are CTkFrames which are dynamically created/destroyed depending on user input. They are stored in a CTkScrollableFrame.
Right now when opening "bookmarks" menu, app loads all of them at once. This is not a problem with only a few widgets, but starts significantly impacting performance and load times with 50,100 or more widgets.
At this point I see 2 solutions:
Problem with the first one is it will eventually load all of the widgets, and if there is a lot of them it will tank the performance.
So second it is.
I couldn't find a way to check what widgets are currently visible (on screen) — if there is a way to actually get the only visible widgets, please let me know.
So without that right now my idea is:
It feels like there should be a better way to do this, I'm missing something
Beta Was this translation helpful? Give feedback.
All reactions