GithubHelp home page GithubHelp logo

doinsight / walk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lxn/walk

0.0 0.0 0.0 4.4 MB

A Windows GUI toolkit for the Go Programming Language

License: Other

Go 99.99% Batchfile 0.01%

walk's Introduction

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.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/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()
}
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.

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, 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"

walk's People

Contributors

adongy avatar akavel avatar bsiegert avatar ccherng avatar daanzu avatar jscholes avatar jtwatson avatar jwatson-gcu avatar knieriem avatar ktye avatar llxwj avatar lxn avatar olekukonko avatar pwolf23 avatar ryujimiya avatar tajtiattila avatar timdufrane avatar tmm1 avatar vanackere avatar zhubicen avatar zobzn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.