Cross platform GUI in Go based on Material Design
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app Fix data race in no-double-run code Jan 12, 2019
canvas Add base text widget with unicode support (#56) Jan 9, 2019
cmd Fix lookup location of files in dir bundling Jan 15, 2019
dialog Add base text widget with unicode support (#56) Jan 9, 2019
driver Fix potential crash on negative image size Jan 8, 2019
img Update to latest example in screenshots Oct 26, 2018
layout Stretch form content elements width if the container grows Jan 9, 2019
test Add package redirects for main import paths Jan 3, 2019
theme Add package redirects for main import paths Jan 3, 2019
vendor Add windows product info setting during package Jan 15, 2019
widget Add support for the Home and End key events Jan 18, 2019
.gitignore Ignore GoLand files Aug 24, 2018
.travis.yml Fix travis parse error Jan 3, 2019
AUTHORS Update AUTHORS (#44) Dec 14, 2018
LICENSE Add BSD license Feb 24, 2018
README.md Fix some style issues Jan 12, 2019
app.go Update Settings() to be in app, not global Dec 20, 2018
canvas.go Allow tests to type to a canvas for window key handlers Dec 30, 2018
canvas_test.go Remove debug output Sep 3, 2018
canvasobject.go Refactor to remove 'Current' and 'Is' getter forms. Dec 9, 2018
container.go Update container ApplyTheme to match new scheme. Dec 23, 2018
container_test.go Fix project imports Dec 29, 2018
driver.go Remove some inefficient code and undesirable APIs Nov 29, 2018
event.go Add a keyboard abstraction so Fyne is input-API agnostic Nov 25, 2018
fyne.go We need to enforce the new URL as we pass around our own imports Jan 2, 2019
geometry.go Fix offset calculations for click handlers Nov 8, 2018
geometry_test.go Fix project imports Dec 29, 2018
key.go Fix an error with backwards compatibility Dec 1, 2018
layout.go Refactor everything in ui/ to the root package Jun 20, 2018
math.go Refactor everything in ui/ to the root package Jun 20, 2018
math_test.go Fix project imports Dec 29, 2018
mouse.go Refactor everything in ui/ to the root package Jun 20, 2018
path.go Fix project imports Dec 29, 2018
resource.go Namespace the tools we will ship, avoid clashes if installing Jan 1, 2019
resource_test.go Fix project imports Dec 29, 2018
serialise.go Fix project imports Dec 29, 2018
serialise_test.go Fix project imports Dec 29, 2018
settings.go Update Settings() to be in app, not global Dec 20, 2018
text.go Fix alignment API issue with Label Sep 20, 2018
theme.go Add a different color for placeholder text. Dec 29, 2018
widget.go Refactor to remove 'Current' and 'Is' getter forms. Dec 9, 2018
window.go Touchup the window padding commit Dec 24, 2018

README.md

GoDoc Reference Mentioned in Awesome Join us on Slack
Code Status Build Status Coverage Status

About

Fyne is an easy to use UI toolkit and app API written in Go. We use the EFL render pipeline to provide cross platform graphics.

This is under heavy development and is not yet capable of supporting a full application

Getting Started

Fyne is designed to be really easy to code with, here are the steps to your first app.

Prerequisites

As Fyne uses CGo you will require a C compiler (typically gcc). On Linux the "gcc" package may already be installed, if not your package manager should have it. On macOS you should install XCode from the Mac App Store, you will also need to run "xcode-select --install" if you have not used the command line tools before. With Windows this can be included by installing TDM-GCC from http://tdm-gcc.tdragon.net/download.

By default Fyne uses the gl golang bindings you may need to also need to install the libgl1-mesa-dev package on Debian/Ubuntu based systems.

Using the standard go tools you can install Fyne's core library using:

go get fyne.io/fyne

Code

And then you're ready to write your first app!

package main

import (
	"fyne.io/fyne/widget"
	"fyne.io/fyne/app"
)

func main() {
	app := app.New()

	w := app.NewWindow("Hello")
	w.SetContent(widget.NewVBox(
		widget.NewLabel("Hello Fyne!"),
		widget.NewButton("Quit", func() {
			app.Quit()
		}),
	))

	w.ShowAndRun()
}

And you can run that simply as:

go run main.go

It should look like this:

Fyne Hello Dark Theme

Scaling

Fyne is built entirely using vector graphics which means that applications that are written using it will scale to any value beautifully (not just whole number values). The default scale value is equated from your screen's DPI - and if you move a window to another screen it will re-calculate and adjust the window size accordingly!

Hello normal size
Standard size
Hello small size
FYNE_SCALE=0.5
Hello large size
FYNE_SCALE=2.5

Themes

Fyne ships with two themes by default, "light" and "dark". You can choose which to use with the environment variable FYNE_THEME. The default is dark:

Fyne Hello Dark Theme

If you prefer a light theme then you could run:

FYNE_THEME=light go run main.go

It should then look like this:

Fyne Hello Light Theme

Widget demo

To run a showcase of the features of fyne execute the following:

cd $GOPATH/src/fyne.io/fyne/cmd/fyne_demo/
go build
./fyne_demo

And you should see something like this (after you click a few buttons):

Fyne Hello Light Theme

Or if you are using the light theme:

Fyne Hello Light Theme

Declarative API

If you prefer a more declarative API then that is provided too. The following is exactly the same as the code above but in this different style.

package main

import (
	"fyne.io/fyne"
	"fyne.io/fyne/app"
	"fyne.io/fyne/widget"
)

func main() {
	app := app.New()

	w := app.NewWindow("Hello")
	w.SetContent(&widget.Box{Children: []fyne.CanvasObject{
		&widget.Label{Text: "Hello Fyne!"},
		&widget.Button{Text: "Quit", OnTapped: func() {
			app.Quit()
		}},
	}})

	w.ShowAndRun()
}

Examples

The main examples have been moved - you can find them in their own repository.