Skip to Main Content
Hands-On GUI Application Development in Go
book

Hands-On GUI Application Development in Go

by Andrew Williams
February 2019
Intermediate to advanced content levelIntermediate to advanced
450 pages
11h 59m
English
Packt Publishing
Content preview from Hands-On GUI Application Development in Go

Background processing

Image processing, even just loading the images to be viewed, is a CPU-intensive task, so if we open a directory with a lot of pictures, the application will be very slow to load. We can fix this delay by moving our image loading to work in the background while we load the user interface. Thankfully, creating new threads for asynchronous processing is very simple with Go (as we explored in Chapter 3, Go to the Rescue!), but we also need to ensure that the user interface is updated accordingly.

To delay the loading of images until there is processing power available, we can replace uses of loadImage() with a replacement asyncImage type that will handle the heavy lifting. The main image loading code will be moved into a ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Building Cross-Platform GUI Applications with Fyne

Building Cross-Platform GUI Applications with Fyne

Andrew Williams

Publisher Resources

ISBN: 9781789138412Supplemental Content