Let’s build a GUI with Gio

#go, #golang, #gui, #gioui

You want a GUI. Of course you do.

Did you know that Go has a great GUI library called Gio? In this 10-part tutorial we will start completely from scratch — with zero background required — and build a self-contained GUI application.

Screenshot of egg_timer

Get started now View it on GitHub

And there’s more

The first tutorial will get you started. But if your needs are more advanced, continue with a more advanced app where we build a Teleprompter that adds animation and reacts to user input, both keyboard shortcut keys and mouse gestures.

Background

Command lines are great and all, but let’s face it, 95% of users aren’t power users. They want buttons to push, toggles to switch, and then to simply get on with their lives. Enter Gio, a great toolkit to build stunningly beautiful, lightning fast and flexible interfaces that meet your needs.

Three out of three

For an interface to work, it must be:

  1. Beautiful
    • No one will use an app that looks like #$%$#!”#
  2. Fast
    • Snappy, instant, responsive, immediate, direct
    • Quick to code, easy to test
  3. Flexible
    • Fits your needs, your ideas, your principles
    • Not impose its will on you
    • Simple should be simple, complex should be allowed

1 and 2 and 3. Beautiful AND Fast AND Flexible. No compromises.

Just do it

“But I don’t know how.”

Agreed, the official Gio website is a bit advanced. Nice repos exist with many examples, but where should you start? If you’re a practical learner you simply want to get started, code something simple, and learn as you go along. That’s me at least, and if you’re like that too, we’re soulmates.

So let’s just do exactly that. The point here is to build something simple from the ground up, and touch upon concepts and ideas as we go along. Every step moves us forward, and every new feature builds on something we’ve touched upon before. The goal is to change the initial “I don’t know how.” to a more optimistic “I don’t know how - yet!”.

Come along for the ride!

Disclaimer

I really like Gio, I like the people behind it, I sponsor it financially and I want it to succeed. But I´m by no means an expert. My goal is simply to share what I’ve learned in the hope that you find it useful. Hope that works.

Also note that Gio is moving fast and not all writeups are updated immediately. Issues and PRs are welcome.

If this is useful, please star the repo on Github, or even better, drop me a line. I really love hearing what people build with Gio.

Cheers!