Need help: How to only generate event before and after finishing dragging or resizing? Generating configure events multiple times and updating the window makes some programs slow.
My TkVersion:8.6 (Use python)
DKF: The events come fron the OS/Windowing System when they come. We have no control over that. But we can control what we do about it.
Tk's default behaviour is to postpone recalculating window sizes and redrawing until the event loop is idle (see after idle), i.e., when the event loop has been drained of pending events. That hides the expensive operations, and is why Tk has been feeling fast since 1990, even though computers were far slower then. Maybe you should do the same in some sense? I don't know what specifically is making your app slow (measure to find out!) but that is the but that should be put off until either idle or after a little bit of a pause (to let further updates "catch up"). Tuning such things is a bit tricky in general, but easier for you as you have your application already.
Python-ZZY - 2023-06-10 08:56:00
Thank you very much. My window is very slow because it changes the effects of some components when the window is resized (i.e. the configure event is generated), such as some 3D components (3D things are only saved as pictures after running once, so the window is only slow at first, and then it isn't). If I change the effect of rendering a 3D image before user's resizing is complete, the configure event will generate multiple times, causing the 3D rendering calculation to run multiple times, and the window will be very slow.
You dont have to know about Tkinter API, because tkinter provides methods to call the tcl/tk code directly.
By the way, it's a little inconvenient to raise issues on such a website, and I think tk could build a server on discord.com