Walk is a "Windows Application Library Kit" for the Go Programming Language.
Its primarily useful for Desktop GUI development, but there is some more stuff.
Make sure you have a working Go installation. See Getting Started
Go 1.0.x
doesn't work with walk anymore, Make sure you use Go 1.1.x
or later.
Now run go get github.com/kumakichi/walk
The preferred way to create GUIs with Walk is to use its declarative sub package, as illustrated in this small example:
package main
import (
"github.com/kumakichi/walk"
. "github.com/kumakichi/walk/declarative"
"strings"
)
func main() {
var inTE, outTE *walk.TextEdit
var mw *walk.MainWindow
if err := (MainWindow{
AssignTo: &mw,
Title: "SCREAMO",
MinSize: Size{300, 200},
Layout: VBox{},
Children: []Widget{
HSplitter{
Children: []Widget{
TextEdit{AssignTo: &inTE},
TextEdit{AssignTo: &outTE, ReadOnly: true},
},
},
PushButton{
Text: "SCREAM",
OnClicked: func() {
outTE.SetText(strings.ToUpper(inTE.Text()))
},
},
},
}.Create()); err != nil {
// do some work
}
mainIcon, err := walk.NewIconFromResource("101")
if err != nil {
// do some work
}
mw.SetIcon(mainIcon)
mw.Run()
}
#include "winver.h"
#define RT_MANIFEST 24
#define CREATEPROCESS_MANIFEST_RESOURCE_ID 1
//#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID 2
//#define ISOLATIONAWARE_NOSTATICIMPORT_MANIFEST_RESOURCE_ID 3
#define IDI_ICON_S 101
#define IMG_SET 102
IDI_ICON_S ICON "a.ico"
IMG_SET BITMAP "Settings.bmp"
CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST MOVEABLE PURE
{
"<?xml version=""1.0"" encoding=""UTF-8"" standalone=""yes""?>"
"<assembly xmlns=""urn:schemas-microsoft-com:asm.v1"" manifestVersion=""1.0"">"
"<assemblyIdentity version=""1.0.0.0"" processorArchitecture=""*"" name=""SomeFunkyNameHere"" type=""win32""/>"
"<description>Your application description here.</description>"
"<dependency>"
"<dependentAssembly>"
"<assemblyIdentity type=""win32"" name=""Microsoft.Windows.Common-Controls"" version=""6.0.0.0"" processorArchitecture=""*"" publicKeyToken=""6595b64144ccf1df"" language=""*""/>"
"</dependentAssembly>"
"</dependency>"
"</assembly>"
}
Then compile the resource file using the windres tool, like this:
windres -o version.syso version.rc
In the directory containing main.go
run
go build
To get rid of the cmd window, instead run
go build -ldflags="-H windowsgui"
demo.exe
There are some examples that should get you started.