Golang for Desktop Applications


(Kevin Maduro) #1

Hello guys, I’ve being studying Golang for a few months, and I got the doubt if there’s anyway to develop a desktop application on golang.
I’m trying to create an model that can work offline and online.
Is there any kind of project or framework to help out this?

P.S.: If I misspell something, let me know pls, I don’t live in a country that has english as mothertongue.

Thanks for your time.


(Eric Lindblad) #2

https://golang.org/pkg/

Projects at the Go Wiki - a curated list of Go projects.

https://golang.org/doc/

See the NonEnglish page at the Wiki for localized documentation.


(Jay Ts) #3

Hi Kevin,

I assume you are asking about GUI applications for desktop computers. Right now, Go supports text-based applications directly, and if you want a graphics toolkit/framework, you will have to look into third-party packages.

I haven’t tried it yet, but here’s one I find very interesting: https://github.com/therecipe/qt

It’s Go bindings for Qt (https://www.qt.io/), which is (arguably?) the best way to develop cross-platform GUI desktop applications. And look at the comments on recent updates: It looks like support for WebAssembly is being added! I don’t get excited easily, and to me, this is OMG - Cool!

This web page is about using C/C++ with Qt and WebAssembly, but look what people have done with Qt’s WebAssembly support:

All of this stuff is very new! So don’t expect perfection yet. If you try it and get anything to work, please report back and let us know!


(Eric Lindblad) #4

The Beginning Linux Programming (WROX) book mentioned in the below About Page - the content might vary between different editions - uses the example of a music CD collection, and walks the reader through the use of ncurses, an RDBMS, and IIRC, in later chapters, one or more GUI implementations, depending on the edition.

About | Index | Labels | Links


(Ignacio Gómez) #5

Though it’s still in alpha, I’ve been using this package lately and it’s been great.


(Jay Ts) #6

Thanks for that. I’ll have to check it out when I can find time.

Qt has a very steep learning curve. It’s been developed since the 1990s, and although it can do a lot, is huge and complicated.

I’ve been thinking that it would be great if Go had its own GUI toolkit.


(Ignacio Gómez) #7

Yeah, Qt seems like an overkill for most things whenever I find myself wanting to add a nice GUI to some program. Every couple of months I check for new graphic solutions in Go and last time I found that package. It’s horribly undocumented, but it being a wrapper for another graphics library the author wrote in C, the code is pretty straightforward and it’s easy to get started quickly.

The other graphics library I played a bit with and want to use more is Pixel, though it’s more oriented to 2D game development. But surely you can make some great GUI with that.

I’d also love some good GUI toolkit, but I don’t think we’ll see an official or community backed one soon, so for now it’s things like this or bindings for Qt, Gtk, etc.


(George Calianu) #8

Were many discutions over the time around Go and GUI but i never heard about one mature and complete solution. After nine years i can guess that probably will not be one in the nearest future. Of course are some more or less useful tries but like i always says until a big company will support developing such a toolkit on long term are very small chanses to see something.


(Kevin Maduro) #9

Yeah, jayts. I’ve seen your thread about it, I found pretty awesome and in a near future I would like to try.
Atm I’m getting used to golang and its universe. Already start looking for some frameworks for APIs like gin-gonic :stuck_out_tongue:
But thanks for this clarification. I’m moving to golang (at least to be my main language) from PHP, Java and C#, I know pretty basic stuff about C/C++.


(Kevin Maduro) #10

I see, thanks for the sharing. I’m jumping hard in golang now, so I’m still lost in some ways.
I came here from a course in the Udemy, and start to dive into it, see some posts and stuff.


(Eric Lindblad) #11

What about writing Golang bindings for XForms Toolkit?

XForms Toolkit | Simple XForms examples | Screenshots

The toolkit was originally used by the Xfce desktop environment before the switch to the GTK+ toolkit.


(Kevin Maduro) #12

Oh, that’s awesome Eric. I’m gonna take a look too.


(Rio M) #13

There are several electron-like projects, where you write GUI in HTML and Javascript.


(Eric Lindblad) #14

Time permitting, if you do look into XForms Toolkit, perhaps you could check rendering in the blackbox window manager; either under Linux or WSL/VcXsrv.

https://nurmi-labs.blogspot.com/2017/03/p9p.html

A WSL screenshot here of p9p’s rio running in VcXsrv.

C# (abandonware).

I’ve never gotten around to resolving CA1001.

https://nurmi-labs.blogspot.com/2017/05/9pc.html

FWIW, djc contributes to Golang’s port to Plan 9.

https://nurmi-labs.blogspot.com/2015/11/pq.html

Screenshot here of his p9p Mothra port.


(Rick Timmis) #15

There is also GTK3 for which there are Go bindings.

GTK UI design can be handled using Glade, and implemented using GTK.Builder

The repo on GitHub looks like it needs some love, but it’s another alternative worth a look

HTH
Rick


(Jay Ts) #16

Sure, gtk+ deserves a mention. A few years ago, I was studying the GUI toolkits for C and C++ that were useful for cross-platform (Linux, macOS, Windows) development, and found three contenders: Qt, gtk+, and wxWindows.

Now that I’m programming in Go, I’ve become used to the idea that things should be simple, quick, and fun. I keep wondering if it would be better to focus on a toolkit written in Go that would be cross-platform and work on every platform supported by Go.

(It’s another subject, but I want cross-platform audio support, too. Right now, Qt does that a little, but not yet really well.)


(Kevin Maduro) #17

Yeah, I found a lot of tutorials about it and I’m thinking to focus on them, since I’m used to HTML and stuff. But before take a decision, I’ll take a look on all of them one by one.


(Rio M) #18

There is interesting project https://github.com/zserge/lorca


(Vikram Rawat) #19

I think you should try the framework beego or buffalo. Then creating the entire web app you can create a binary file which will run a server on a local port and anybody going to that port can access the web app.

Its very easy and have no limitation. I have tried it and it works fine. Just create a binary and see for yourself. Both have a command for creating binary.


(Eric Lindblad) #20

@vikram-rawat

The reason I pointed to this ‘Desktop’ topic was that some years ago code was authored as an X Window System server, which included code to run a GUI inside a Netscape web browser; from the Screenshots Page from my log, here’s a link (hosted by MediaFire) to a boring screenshot as a single window on an XP desktop.

Other code was written for that Japanese authored software that included alpha hacks.

applet