Skip to content

When to use fyne.Do #5577

Answered by dweymouth
nagylzs asked this question in Q&A
Mar 6, 2025 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

You should use fyne.Do or fyne.DoAndWait whenever you are invoking any Fyne APIs other than ones specifically marked as excluded (currently only data binding) from a goroutine that your code created. This includes calling Refresh() as well as setting properties on widgets, CanvasObjects, etc.

All callbacks from Fyne to your own code are now guaranteed to occur on the "app goroutine" - ie main - so it is never needed to use fyne.Do[AndWait] in your Fyne event handlers/ callbacks.

All functions passed to fyne.Do[AndWait] are executed sequentially in the order received.

Replies: 2 comments 2 replies

Comment options

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

Answer selected by nagylzs
Comment options

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

Jacalz Mar 7, 2025
Collaborator

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