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

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.