walk

package module
v0.0.0-...-fb9fbbc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2018 License: BSD-3-Clause Imports: 0 Imported by: 0

README

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](http://golang.org/doc/install.html)

##### Note
`Go 1.7.x` doesn't work with walk anymore, Make sure you use `Go 1.8.x` or later.

##### To Install
Now run `go get github.com/muumlover/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`

```go
package main

import (
	"github.com/muumlover/walk"
	. "github.com/muumlover/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()
}
```

##### 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](http://i.imgur.com/lUrgE2Q.png)

##### More Examples
There are some [examples](examples) that should get you started.

Program Crashes
===============
By default Go uses os threads with small stack sizes of 128KB. If your walk app crashes, it may be due
to a stack overflow. Until a [better solution is found](https://github.com/golang/go/issues/20975),
you can work around this by adding

    import _ "runtime/cgo"

somewhere in your program. If you don't have `gcc` installed and on your `PATH`,
you can alternatively add `-linkmode internal` to the `-ldflags` of your `go build` command like so:

    go build -ldflags="-H windowsgui -linkmode internal"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TextLabel

type TextLabel struct {
	// contains filtered or unexported fields
}

func NewTextLabel

func NewTextLabel(parent Container) (*TextLabel, error)

func NewTextLabelWithStyle

func NewTextLabelWithStyle(parent Container, style uint32) (*TextLabel, error)

func (*TextLabel) HeightForWidth

func (tl *TextLabel) HeightForWidth(width int) int

func (*TextLabel) LayoutFlags

func (*TextLabel) LayoutFlags() LayoutFlags

func (*TextLabel) MinSizeHint

func (tl *TextLabel) MinSizeHint() Size

func (*TextLabel) SetText

func (tl *TextLabel) SetText(text string) error

func (*TextLabel) SetTextAlignment

func (tl *TextLabel) SetTextAlignment(alignment Alignment2D) error

func (*TextLabel) SizeHint

func (tl *TextLabel) SizeHint() Size

func (*TextLabel) Text

func (tl *TextLabel) Text() string

func (*TextLabel) TextAlignment

func (tl *TextLabel) TextAlignment() Alignment2D

Directories

Path Synopsis
examples
statusbar
This example demonstrates the status bar, including a size gripper attached to the bottom of the main window.
This example demonstrates the status bar, including a size gripper attached to the bottom of the main window.
tools

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL