Skip to content

Need help changing image in a toga.imageview #1279

Answered by freakboy3742
vachanmn123 asked this question in Q&A
Discussion options

You must be logged in to vote

GUIs only update when they're in the "redraw" portion of their application event loop. An event handler is executed as part of the same event loop, so if you're currently in a handler, the redraw portion of the event loop isn't being processed. As a result, any changes to the image won't be redrawn until you get to the end of the handler, at which point the value of the image at the end of the handler will be the "current" image, and it will be the image that is drawn.

The call to sleep() is also problematic. The handler will be blocking the event loop until the entire handler method has finished; by calling sleep(), the handler will take multiple seconds to complete, during which time th…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@vachanmn123
Comment options

Comment options

You must be logged in to vote
1 reply
@vachanmn123
Comment options

Answer selected by vachanmn123
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants