Skip to content
/ walk Public
forked from lxn/walk

A Windows GUI toolkit for the Go Programming Language

License

Notifications You must be signed in to change notification settings

tailscale/walk

This branch is 89 commits ahead of lxn/walk:master.

Folders and files

NameName
Last commit message
Last commit date
Dec 18, 2024
Feb 25, 2011
Oct 8, 2024
Feb 3, 2023
Jun 13, 2024
Dec 9, 2022
Sep 24, 2020
Jul 23, 2024
Nov 3, 2021
Sep 16, 2010
Apr 11, 2024
Apr 11, 2024
Oct 8, 2024
Jun 13, 2024
Feb 14, 2025
Feb 8, 2023
Dec 6, 2022
Nov 19, 2024
Aug 20, 2024
Aug 20, 2024
Nov 13, 2019
Feb 8, 2023
Dec 6, 2022
Dec 6, 2022
Nov 13, 2019
Sep 15, 2015
Dec 6, 2022
Apr 11, 2024
Dec 6, 2022
Feb 27, 2017
Oct 8, 2024
Dec 6, 2022
Aug 30, 2024
Sep 17, 2019
Dec 6, 2022
Jul 29, 2020
Sep 26, 2024
Dec 4, 2024
Dec 6, 2022
Dec 6, 2022
Nov 13, 2019
Apr 11, 2024
Dec 5, 2018
Dec 6, 2022
Aug 30, 2024
Aug 30, 2024
Feb 13, 2025
Apr 11, 2024
Feb 13, 2025
Feb 13, 2025
Dec 6, 2022
Sep 27, 2019
Dec 13, 2024
Dec 2, 2024
Aug 30, 2024
Sep 4, 2019
Dec 6, 2022
Dec 6, 2022
Dec 6, 2022
Sep 17, 2019
Nov 13, 2019
Nov 13, 2019
Dec 6, 2022
Nov 13, 2019
Dec 6, 2022
Feb 13, 2025
Dec 6, 2022
Dec 6, 2022
Nov 19, 2024
Oct 8, 2024
Sep 15, 2015
Jun 14, 2024
Aug 20, 2024
Mar 17, 2023
Apr 11, 2024
Dec 6, 2022
Dec 2, 2024
Dec 6, 2022
Oct 8, 2024
Dec 6, 2022
Mar 6, 2025
Dec 6, 2022
Jul 29, 2020
Dec 6, 2022
Dec 6, 2022
Dec 6, 2022
Jul 5, 2023
Dec 6, 2022
Dec 6, 2022
Feb 25, 2019
Dec 4, 2024
Dec 6, 2022
Feb 8, 2023
Nov 13, 2019
Dec 6, 2022
Aug 30, 2024
Sep 26, 2019
Dec 6, 2022
Dec 6, 2022
Dec 5, 2018
Dec 6, 2022
Dec 6, 2022
Sep 27, 2019
Dec 6, 2022
Dec 2, 2024
Dec 6, 2022
Dec 2, 2024
Apr 11, 2024
Dec 6, 2022
Aug 26, 2019
Nov 13, 2019
Apr 11, 2024
Dec 6, 2022
Jul 29, 2020
Dec 6, 2022
Dec 6, 2022
Dec 6, 2022
Mar 12, 2025
Dec 6, 2022
Jul 29, 2020
Jul 15, 2024
Dec 2, 2024
Dec 6, 2022
Dec 6, 2022
Dec 6, 2022
Nov 13, 2019
Dec 6, 2022
Nov 19, 2024
Oct 9, 2017
Feb 27, 2017
Dec 6, 2022
Dec 6, 2022
Dec 6, 2022
Dec 6, 2022
Dec 6, 2022
Dec 6, 2022
Dec 6, 2022
Dec 4, 2024
Dec 6, 2022
Dec 2, 2024
Dec 4, 2024

Repository files navigation

About Walk

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.

Fork from original module

This is a fork from the original module.

Setup

Make sure you have a working Go installation. See Getting Started

Note

Walk currently requires Go 1.21 or later.

To Install

Now run go get github.com/tailscale/walk

Using Walk

A Walk application must always begin with a call to walk.InitApp().

The preferred way to create GUIs with Walk is to use its declarative sub package, as illustrated in this small example:

test.go
package main

import (
	"log"
	"strings"

	"github.com/tailscale/walk"
	. "github.com/tailscale/walk/declarative"
)

func main() {
	app, err := walk.InitApp()
		if err != nil {
		log.Fatal(err)
	}

	var inTE, outTE *walk.TextEdit

	MainWindow{
		Title:   "SCREAMO",
		MinSize: Size{600, 400},
		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()

	app.Run()
}
Create Manifest test.manifest
<?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"/>
    <dependency>
        <dependentAssembly>
            <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
        </dependentAssembly>
    </dependency>
    <application xmlns="urn:schemas-microsoft-com:asm.v3">
        <windowsSettings>
            <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
            <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True</dpiAware>
        </windowsSettings>
    </application>
</assembly>

Then either compile the manifest using the rsrc tool, like this:

go get github.com/akavel/rsrc
rsrc -manifest test.manifest -o rsrc.syso

or rename the test.manifest file to test.exe.manifest and distribute it with the application instead.

Build app

In the directory containing test.go run

go build

To get rid of the cmd window, instead run

go build -ldflags="-H windowsgui"
Run app
test.exe
Sample Output (Windows 7)

alt tag

More Examples

There are some examples that should get you started.

Application Manifest Files

Walk requires Common Controls 6. This means that you must put an appropriate application manifest file either next to your executable or embedded as a resource.

You can copy one of the application manifest files that come with the examples.

To embed a manifest file as a resource, you can use the rsrc tool.

IMPORTANT: If you don't embed a manifest as a resource, then you should not launch your executable before the manifest file is in place. If you do anyway, the program will not run properly. And worse, Windows will not recognize a manifest file, you later drop next to the executable. To fix this, rebuild your executable and only launch it with a manifest file in place.

About

A Windows GUI toolkit for the Go Programming Language

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%