-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Canvas method to request a new draw #63
Comments
I'm wondering if we should just leave this up to the application developer by providing an API that allows them to do it. |
Nice work on the docs! The GUI API page's examples left me a little confused though; where are the calls to Looking at the Qt canvas a little better, it appears that Qt is making the calls, rather than the python code. I guess my expectations were somewhat different here. I understand that Qt will trigger a draw when the window is resized for example, or opened for the first time. Does Qt also continuously trigger drawing when there is no interaction, or does the user then need to use |
Good question. The GUI toolkit will indeed request a new draw when it knows that the visualization needs to be refreshed. Like when the window is resized, and om some systems when part of the window was hidden by another window and is now shown again. This was already the case before #78. What was added was the possibility for the user to request a draw. E.g. in cases that the visualization itself has changed. This works somewhat different for Qt and glfw. In Qt the former already works automatically, and requesting a draw is done simply by calling For glfw you have to bring your own event loop. So this draw event ... we have to do that ourselves. The simplest way I could find to realize this is by adding a single function ( In both cases, the window will not be redrawn continuously, unless you keep requesting redraws. |
Ok, great, that's perfect!
Just to make sure I fully understand the details here: so Qt does not continuously call |
Haha, now I'm not sure if I understand your question correctly :) So, indeed Qt by itself only generates a new draw event when the window is somehow invalid (e.g. on resize). This means that our users need to call (In theory our users could just as well call |
Got it! Thanks |
Having a (cross-gui-toolkit) method that can be used to request a new draw would be nice. When using qt
canvas.update()
does the trick, but a more general solution would be favorable, plus we can add some niceties:window.requestAnimationFrame
schedules a draw call indirectly (non-blocking)The text was updated successfully, but these errors were encountered: