Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
A Windows GUI toolkit for the Go Programming Language
Go
Branch: master
Failed to load latest commit information.
data Update README; add screenshots
declarative Take measures against resource leaks.
examples examples: Also updated rsrc.syso files
l10n Add support for providing translated strings
tools/ui2walk Rename RootWidget to Form
AUTHORS Add myself to AUTHORS :)
LICENSE Initial commit \o/
README.mdown Merge branch 'master' of github.com:lxn/walk
action.go Take measures against resource leaks.
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 CheckBox: Add support for 3-state mode
cancelevent.go Fix recently introduced events bug
canvas.go Use win instead of go-winapi package and import qualified
checkbox.go CheckBox: Add support for 3-state mode
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 Don't ask...
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 Don't ask...
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 Don't ask...
dateedit.go Don't ask...
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 Cache and reuse fonts.
form.go Don't ask...
gridlayout.go Don't ask...
groupbox.go Don't ask...
icon.go Don't ask...
image.go Don't ask...
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 Don't ask...
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 Don't ask...
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 Don't ask...
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 Don't ask...
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 TableView: Don't reset sorting when replacing model
registry.go Use win instead of go-winapi package and import qualified
scrollview.go ScrollView: Make persistable and usable as drop-in replacement for Co…
simpletypes.go Revert directory layout to what we had initially
size.go Some Splitter and layout improvements
spacer.go Don't ask...
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 TableView: Don't reset sorting when replacing model
tableviewcolumn.go Don't ask...
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 Don't ask...
tooltip.go ToolTip: Embed WindowBase instead of WidgetBase
treeitemevent.go TreeView: Refactor to a model based design
treeview.go TreeView: Fix garbage collected item text
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 Don't ask...
widgetlist.go Use win instead of go-winapi package and import qualified
window.go Make keyboard shortcut handling more sane.

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.