Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

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

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.