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

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.