Skip to content
A Windows GUI toolkit for the Go Programming Language
Go
Find file
Latest commit ab5e7ee @lxn Merge branch 'trackbar'
Failed to load latest commit information.
data Update README; add screenshots
declarative update slider control
examples handle slider messages
l10n Add support for providing translated strings
tools/ui2walk Rename RootWidget to Form
AUTHORS Clean up dropfiles api
LICENSE Initial commit \o/
README.mdown Merge branch 'master' of github.com:lxn/walk
action.go Add build tags to allow this library to be included in a cross platfo…
actionlist.go Add build tags to allow this library to be included in a cross platfo…
application.go Add build tags to allow this library to be included in a cross platfo…
bitmap.go Add build tags to allow this library to be included in a cross platfo…
boxlayout.go Add build tags to allow this library to be included in a cross platfo…
brush.go Add build tags to allow this library to be included in a cross platfo…
button.go Add build tags to allow this library to be included in a cross platfo…
cancelevent.go Add build tags to allow this library to be included in a cross platfo…
canvas.go Add build tags to allow this library to be included in a cross platfo…
checkbox.go Add build tags to allow this library to be included in a cross platfo…
clipboard.go Add build tags to allow this library to be included in a cross platfo…
closeevent.go Add build tags to allow this library to be included in a cross platfo…
color.go Add build tags to allow this library to be included in a cross platfo…
combobox.go ComboBox: Recalculate max item text width on font change
commondialogs.go FileDialog: Add ShowOpenMultiple, fixes #182
composite.go Add build tags to allow this library to be included in a cross platfo…
condition.go Add build tags to allow this library to be included in a cross platfo…
container.go handle slider messages
cursor.go Add build tags to allow this library to be included in a cross platfo…
customwidget.go CustomWidget: add missing SetViewportOrgEx call
databinding.go DataBinding: add new DataField interface
dateedit.go Add build tags to allow this library to be included in a cross platfo…
dialog.go Add build tags to allow this library to be included in a cross platfo…
dropfilesevent.go Dropfiles: call DragAcceptFiles only once
error.go Add build tags to allow this library to be included in a cross platfo…
errorevent.go Add build tags to allow this library to be included in a cross platfo…
event.go Add build tags to allow this library to be included in a cross platfo…
font.go Add build tags to allow this library to be included in a cross platfo…
form.go Fix mouse events
gridlayout.go Add build tags to allow this library to be included in a cross platfo…
groupbox.go GroupBox: Fix SetTitle having no visible effect, fixes #162, thanks C…
icon.go Add build tags to allow this library to be included in a cross platfo…
image.go Add build tags to allow this library to be included in a cross platfo…
imagelist.go Add build tags to allow this library to be included in a cross platfo…
imageview.go Add build tags to allow this library to be included in a cross platfo…
inifilesettings.go Add build tags to allow this library to be included in a cross platfo…
intevent.go Add build tags to allow this library to be included in a cross platfo…
keyboard.go Add build tags to allow this library to be included in a cross platfo…
keyevent.go Add build tags to allow this library to be included in a cross platfo…
label.go Add build tags to allow this library to be included in a cross platfo…
lineedit.go Add build tags to allow this library to be included in a cross platfo…
lineerrorpresenter.go LineErrorPresenter: Override applyEnabled
listbox.go set listbox default to single selection
mainwindow.go MainWindow, Menu: Fix menu bar not being redrawn when inserting or re…
maptablemodel.go Add build tags to allow this library to be included in a cross platfo…
menu.go MainWindow, Menu: Fix menu bar not being redrawn when inserting or re…
messagebox.go Add build tags to allow this library to be included in a cross platfo…
metafile.go Add build tags to allow this library to be included in a cross platfo…
models.go Add build tags to allow this library to be included in a cross platfo…
mouseevent.go To add the mouse wheel event processing for WindowBase
notifyicon.go Add build tags to allow this library to be included in a cross platfo…
numberedit.go NumberEdit: fix tooltips
path.go Add build tags to allow this library to be included in a cross platfo…
pen.go Add build tags to allow this library to be included in a cross platfo…
point.go Add build tags to allow this library to be included in a cross platfo…
progressbar.go ProgressBar: Add MarqueeMode
progressindicator.go Add build tags to allow this library to be included in a cross platfo…
property.go Add build tags to allow this library to be included in a cross platfo…
pushbutton.go Add build tags to allow this library to be included in a cross platfo…
radiobutton.go Add build tags to allow this library to be included in a cross platfo…
rectangle.go Add build tags to allow this library to be included in a cross platfo…
reflectmodels.go DataBinding: add new DataField interface
registry.go Add build tags to allow this library to be included in a cross platfo…
scrollview.go Fix mouse events
simpletypes.go Add build tags to allow this library to be included in a cross platfo…
size.go Add build tags to allow this library to be included in a cross platfo…
slider.go handle slider messages
spacer.go Add build tags to allow this library to be included in a cross platfo…
splitter.go Add build tags to allow this library to be included in a cross platfo…
splitterhandle.go Add build tags to allow this library to be included in a cross platfo…
splitterlayout.go Add build tags to allow this library to be included in a cross platfo…
statusbar.go Add build tags to allow this library to be included in a cross platfo…
tableview.go TableView: Make single item selection the default (breaking change)
tableviewcolumn.go Add build tags to allow this library to be included in a cross platfo…
tableviewcolumnlist.go Add build tags to allow this library to be included in a cross platfo…
tabpage.go Add build tags to allow this library to be included in a cross platfo…
tabpagelist.go Add build tags to allow this library to be included in a cross platfo…
tabwidget.go Add build tags to allow this library to be included in a cross platfo…
textedit.go Sets the max length of an text edit.
toolbar.go Add build tags to allow this library to be included in a cross platfo…
toolbutton.go Add build tags to allow this library to be included in a cross platfo…
tooltip.go ToolTip: allow 79 code points, not bytes for text
treeitemevent.go Add build tags to allow this library to be included in a cross platfo…
treeview.go Add build tags to allow this library to be included in a cross platfo…
util.go Add build tags to allow this library to be included in a cross platfo…
validators.go Add build tags to allow this library to be included in a cross platfo…
walk.go Add build tags to allow this library to be included in a cross platfo…
webview.go Add build tags to allow this library to be included in a cross platfo…
webview_dwebbrowserevents2.go Add build tags to allow this library to be included in a cross platfo…
webview_idochostuihandler.go Add build tags to allow this library to be included in a cross platfo…
webview_ioleclientsite.go Add build tags to allow this library to be included in a cross platfo…
webview_ioleinplaceframe.go Add build tags to allow this library to be included in a cross platfo…
webview_ioleinplacesite.go Add build tags to allow this library to be included in a cross platfo…
widget.go Add build tags to allow this library to be included in a cross platfo…
widgetlist.go Add build tags to allow this library to be included in a cross platfo…
window.go handle slider messages

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.