Skip to content
This repository

A Windows GUI toolkit for the Go Programming Language

branch: master
Octocat-spinner-32 data Update README; add screenshots February 26, 2011
Octocat-spinner-32 declarative ComboBox: Add MaxLength January 16, 2014
Octocat-spinner-32 examples use rsrc-compiled embeddable manifests December 09, 2013
Octocat-spinner-32 l10n Add support for providing translated strings October 21, 2012
Octocat-spinner-32 tools Rename RootWidget to Form July 16, 2013
Octocat-spinner-32 AUTHORS AUTHORS: Add Mateusz Czapliński December 10, 2013
Octocat-spinner-32 LICENSE Initial commit \o/ September 16, 2010
Octocat-spinner-32 README.mdown Merge branch 'master' of github.com:lxn/walk December 10, 2013
Octocat-spinner-32 action.go ToolBar: Add support for drop-down buttons May 30, 2013
Octocat-spinner-32 actionlist.go Reduce indentation May 28, 2013
Octocat-spinner-32 application.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 bitmap.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 boxlayout.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 brush.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 button.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 cancelevent.go Fix recently introduced events bug February 24, 2012
Octocat-spinner-32 canvas.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 checkbox.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 clipboard.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 closeevent.go Fix recently introduced events bug February 24, 2012
Octocat-spinner-32 color.go Revert directory layout to what we had initially February 20, 2012
Octocat-spinner-32 combobox.go ComboBox: Don't leak window handle if widget creation fails January 16, 2014
Octocat-spinner-32 commondialogs.go FileDialog: Return uintptr from callback, fixes #75 October 27, 2013
Octocat-spinner-32 composite.go Reduce widgets footprint a bit by removing unneeded interface fields July 26, 2013
Octocat-spinner-32 condition.go Add Condition interface and some implementations April 30, 2013
Octocat-spinner-32 container.go Remove pointless ContainerBase.init func September 24, 2013
Octocat-spinner-32 cursor.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 customwidget.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 databinding.go Introduce Window and WindowBase as base for all windows July 24, 2013
Octocat-spinner-32 dateedit.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 dialog.go Dialog: Change firstFocusableDescendant to return a Window July 26, 2013
Octocat-spinner-32 error.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 errorevent.go Fix recently introduced events bug February 24, 2012
Octocat-spinner-32 event.go Fix recently introduced events bug February 24, 2012
Octocat-spinner-32 font.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 form.go MainWindow: Move standard bars out of clientComposite August 04, 2013
Octocat-spinner-32 gridlayout.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 groupbox.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 icon.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 image.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 imagelist.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 imageview.go Reduce widgets footprint a bit by removing unneeded interface fields July 26, 2013
Octocat-spinner-32 indexlist.go Revert directory layout to what we had initially February 20, 2012
Octocat-spinner-32 inifilesettings.go Improve widget state persistence May 15, 2013
Octocat-spinner-32 intevent.go Fix recently introduced events bug February 24, 2012
Octocat-spinner-32 keyboard.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 keyevent.go Make key codes be of type Key and implement fmt.Stringer for it May 09, 2013
Octocat-spinner-32 label.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 lineedit.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 lineerrorpresenter.go Reduce widgets footprint a bit by removing unneeded interface fields July 26, 2013
Octocat-spinner-32 listbox.go ListBox: Add HasCurrentItem property January 16, 2014
Octocat-spinner-32 mainwindow.go MainWindow: Move standard bars out of clientComposite August 04, 2013
Octocat-spinner-32 maptablemodel.go mapTableModel: s/index/row May 16, 2013
Octocat-spinner-32 menu.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 messagebox.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 metafile.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 models.go Add interfaces for reflect based models April 30, 2013
Octocat-spinner-32 mouseevent.go Fix recently introduced events bug February 24, 2012
Octocat-spinner-32 notifyicon.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 numberedit.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 path.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 pen.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 point.go Revert directory layout to what we had initially February 20, 2012
Octocat-spinner-32 progressbar.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 progressindicator.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 property.go Introduce Window and WindowBase as base for all windows July 24, 2013
Octocat-spinner-32 pushbutton.go PushButton: Add image support November 22, 2013
Octocat-spinner-32 radiobutton.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 rectangle.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 reflectmodels.go Move body of tableReflectModel.Less to new less func May 16, 2013
Octocat-spinner-32 registry.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 simpletypes.go Revert directory layout to what we had initially February 20, 2012
Octocat-spinner-32 size.go Some Splitter and layout improvements June 07, 2012
Octocat-spinner-32 spacer.go Introduce Window and WindowBase as base for all windows July 24, 2013
Octocat-spinner-32 splitter.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 splitterhandle.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 splitterlayout.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 statusbar.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 tableview.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 tableviewcolumn.go TableViewColumn: Use DataMember as fallback for empty Title October 27, 2013
Octocat-spinner-32 tableviewcolumnlist.go TableViewColumnList: In Insert, only call item.create if the column i… April 30, 2013
Octocat-spinner-32 tabpage.go TabWidget: Add support for tab page image, fixes #74 November 22, 2013
Octocat-spinner-32 tabpagelist.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 tabwidget.go TabWidget: Add support for tab page image, fixes #74 November 22, 2013
Octocat-spinner-32 textedit.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 toolbar.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 toolbutton.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 tooltip.go ToolTip: Embed WindowBase instead of WidgetBase July 30, 2013
Octocat-spinner-32 treeitemevent.go TreeView: Refactor to a model based design October 25, 2012
Octocat-spinner-32 treeview.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 util.go Fix less utility function for descending sort order January 23, 2014
Octocat-spinner-32 validators.go Add support for providing translated strings October 21, 2012
Octocat-spinner-32 walk.go TabWidget: Add support for tab page image, fixes #74 November 22, 2013
Octocat-spinner-32 webview.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 webview_dwebbrowserevents2.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 webview_idochostuihandler.go Use syscall.GUID January 21, 2014
Octocat-spinner-32 webview_ioleclientsite.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 webview_ioleinplaceframe.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 webview_ioleinplacesite.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 widget.go ToolTip: Embed WindowBase instead of WidgetBase July 30, 2013
Octocat-spinner-32 widgetlist.go Use win instead of go-winapi package and import qualified July 25, 2013
Octocat-spinner-32 window.go Remove pointless ContainerBase.init func September 24, 2013
README.mdown

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.

Setup

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

Note

Go 1.0.x doesn't work with walk anymore, Make sure you use Go 1.1.x or later.

To Install

Now run go get github.com/lxn/walk

Using Walk

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 (
    "github.com/lxn/walk"
    . "github.com/lxn/walk/declarative"
    "strings"
)

func main() {
    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()))
                },
            },
        },
    }.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>
    </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.

Something went wrong with that request. Please try again.