Book Image

Hands-On GUI Application Development in Go

By : Andrew Williams
Book Image

Hands-On GUI Application Development in Go

By: Andrew Williams

Overview of this book

Go is often compared to C++ when it comes to low-level programming and implementations that require faster processing, such as Graphical User Interfaces (GUIs). In fact, many claim that Go is superior to C++ in terms of its concurrency and ease of use. Most graphical application toolkits, though, are still written using C or C++, and so they don't enjoy the benefits of using a modern programming language such as Go. This guide to programming GUIs with Go 1.11 explores the various toolkits available, including UI, Walk, Shiny, and Fyne. The book compares the vision behind each project to help you pick the right approach for your project. Each framework is described in detail, outlining how you can build performant applications that users will love. To aid you further in creating applications using these emerging technologies, you'll be able to easily refer to code samples and screenshots featured in the book. In addition to toolkit-specific discussions, you'll cover more complex topics, such as how to structure growing graphical applications, and how cross-platform applications can integrate with each desktop operating system to create a seamless user experience. By delving into techniques and best practices for organizing and scaling Go-based graphical applications, you'll also glimpse Go's impressive concurrency system. In the concluding chapters, you'll discover how to distribute to the main desktop marketplaces and distribution channels. By the end of this book, you'll be a confident GUI developer who can use the Go language to boost the performance of your applications.
Table of Contents (25 chapters)
Title Page
Copyright and Credits
About Packt
Contributors
Preface
Comparison of GUI Toolkits
Index

Appendix 3. Comparison of GUI Toolkits

In this book, we explored seven popular GUI toolkits for the Go language. It's recommended to read each chapter and understand the benefits and potential drawbacks of each toolkit before making a decision on which to use in a project. For a quick reference, the following table should help to short-list options based on a number of important factors:

Name

License

MultiplePlatforms

Active

Themes

Nativewidgets

Idiomatic

Cross compiling

Richness

Walk

BSD

andlabs UI

MIT

!1

-

Go-GTK

LGPL2

!3

!4

qt

LGPL

!3

5

Shiny

BSD

!6

nk

MIT

!6

-

Fyne

BSD

!6

 

1 The top, declarative, layer of the andlabs UI is designed for Go development; however, it exposes C idioms from the lower-level library.2 The go-GTK library is available in multiple licenses, but the inclusion of the GTK+ widgets requires LGPL.3 Using theming capabilities, a native-looking user interface can be obtained.4 Cross compiling should be possible, but it requires many libraries to be compiled for each target system.

5 The supported way to cross compile is through the use of containers rather than directly on the development computer.6 Themes can be set from code but there's no collection of user installable themes.

The preceding table should help with the choice of which GUI technology to use. There's no single best option and selection should be made based on your most important criteria. Clarification of each heading is as follows:

License: Every toolkit is available under an open source license that allows for open or closed source and commercial usage. However, as a statically compiled language, there are complications when using the LGPL. If statically linking with an LGPL project, your code should either be distributed under the same license or you'll need to provide an alternative compiled output without the library statically linked. The easiest option in this case may be to leave the toolkit as a dynamically compiled library that the user would have to install before your application can function. Some of the toolkits are available under a separate commercial license that can be paid for to avoid licensing complications.

Multiple Platforms: A tick mark represents the toolkit supporting at least Linux, macOS, and Windows. Some of the options provide support for many more platforms.

Active: Is the project actively maintained? An active project doesn't guarantee the availability of commercial support.

Themes: A tick mark represents user installable themes that can customize application appearance. Some toolkits support setting a theme using code that allows application developers to change the look and feel.

Native Widgets: Does the framework use native system widgets? A tick means that applications will utilize the system widgets. Some toolkits make it possible to look like the system widgets by installing a special theme.

Idiomatic: Is the toolkit built to fit with the Go language idioms? This may not be important to every project, but it can improve the speed of development and ease of maintenance. It can also be easier to debug applications that use an idiomatic toolkit.

Cross compiling: Cross compilation is usually important for Go applications. Not all toolkits support this completely due to the complexity of working with low level graphics libraries.

 

 

Richness: This is a measure of how complete the selection of widgets is. An up arrow indicates that you could build a complete application using the provided features. A bar (neither up nor down) shows that most applications should be possible but that it may be necessary to construct complex widgets using the available components. A down arrow shows a minimal widget set—simple or medium complexity applications are possible but many widgets would need to be built from the basic components provided.