张金坤 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
..
data 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
declarative 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
examples 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
l10n 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
tools 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
AUTHORS 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
LICENSE 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
README.mdown 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
action.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
actionlist.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
application.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
bitmap.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
boxlayout.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
brush.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
button.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
cancelevent.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
canvas.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
checkbox.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
clipboard.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
closeevent.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
color.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
combobox.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
commondialogs.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
composite.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
condition.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
container.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
cursor.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
customwidget.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
databinding.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
dateedit.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
dialog.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
dropfilesevent.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
error.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
errorevent.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
event.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
font.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
form.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
gridlayout.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
groupbox.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
icon.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
image.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
imagelist.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
imageview.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
inifilesettings.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
intevent.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
keyboard.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
keyevent.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
label.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
lineedit.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
lineerrorpresenter.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
listbox.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
mainwindow.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
maptablemodel.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
menu.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
messagebox.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
metafile.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
models.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
mouseevent.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
notifyicon.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
numberedit.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
path.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
pen.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
point.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
progressbar.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
progressindicator.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
property.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
pushbutton.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
radiobutton.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
rectangle.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
reflectmodels.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
registry.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
scrollview.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
simpletypes.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
size.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
slider.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
spacer.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
splitter.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
splitterhandle.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
splitterlayout.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
statusbar.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
tableview.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
tableviewcolumn.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
tableviewcolumnlist.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
tabpage.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
tabpagelist.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
tabwidget.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
textedit.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
toolbar.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
toolbutton.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
tooltip.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
treeitemevent.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
treeview.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
util.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
validators.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
walk.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
webview.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
webview_dwebbrowserevents2.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
webview_idochostuihandler.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
webview_ioleclientsite.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
webview_ioleinplaceframe.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
webview_ioleinplacesite.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
widget.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
widgetlist.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos
window.go 7c30976f1a 增加工具包 %!s(int64=9) %!d(string=hai) anos

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.