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

Communicating with the GUI

To add the code that handles updating the GUI and responding to user events, we will need to save references to some widgets that have been created; mainly the widget.Label toolbar and the main view, canvas.Image. By storing these references, we can update their content later.

Additionally, we will add a []string to list images for the directory we are accessing and save int index of the current image so that we can calculate the previous and the next. Once those are created, we can fill in the content of our previousImage() and nextImage() functions to call a new chooseImage() function that will update the display:

var images []stringvar index intvar image *canvas.Imagevar label *widget.Labelfunc previousImage ...
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