fyne

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2019 License: BSD-3-Clause Imports: 7 Imported by: 0

README

GoDoc Reference 1.0.0 release 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 OpenGL (through the go-gl and go-glfw projects) to provide cross platform graphics.

The 1.0 release is now out and we encourage feedback and requests for the next major releae :).

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). If you don't have one set up the instructions at Compiling may help.

By default Fyne uses the gl golang bindings which means you need a working OpenGL configuration. Debian/Ubuntu based systems may need to also need to install the libgl1-mesa-dev and xorg-dev packages.

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

Note that windows applications load from a command prompt by default, which means if you click an icon you may see a command window. To fix this add the parameters -ldflags -H=windowsgui to your run or build commands.

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 calculated from your screen's DPI - and if you move a window to another screen it will re-scale and adjust the window size accordingly! We call this "auto scaling" and it is designed to keep an app GUI the same size as you change monitor. You can override this behaviour by setting a specific scale using the FYNE_SCALE environment variable.

Hello normal size
Standard sizeHello small size
FYNE_SCALE=0.5Hello 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.

Documentation

Overview

Package fyne describes the objects and components available to any Fyne app. These can all be created, manipulated and tested without rendering (for speed). Your main package should use the app package to create an application with a default driver that will render your UI.

A simple application may look like this:

package main

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

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

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

	w.ShowAndRun()
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogError added in v1.0.0

func LogError(reason string, err error)

LogError reports an error to the command line with the specified err cause, if not nil. The function also reports basic information about the code location.

func Max added in v1.0.0

func Max(x, y int) int

Max returns the larger of the passed values.

func Min added in v1.0.0

func Min(x, y int) int

Min returns the smaller of the passed values.

func SetCurrentApp added in v1.0.0

func SetCurrentApp(current App)

SetCurrentApp is an internal function to set the app instance currently running.

Types

type App added in v1.0.0

type App interface {
	// Create a new window for the application.
	// The first window to open is considered the "master" and when closed
	// the application will exit.
	NewWindow(title string) Window

	// Open a URL in the default browser application.
	OpenURL(url *url.URL) error

	// Icon returns the application icon, this is used in various ways
	// depending on operating system.
	// This is also the default icon for new windows.
	Icon() Resource

	// SetIcon sets the icon resource used for this application instance.
	SetIcon(Resource)

	// Run the application - this starts the event loop and waits until Quit()
	// is called or the last window closes.
	// This should be called near the end of a main() function as it will block.
	Run()

	// Calling Quit on the application will cause the application to exit
	// cleanly, closing all open windows.
	Quit()

	// Driver returns the driver that is rendering this application.
	// Typically not needed for day to day work, mostly internal functionality.
	Driver() Driver

	// Settings return the application settings, determining theme and so on.
	Settings() Settings
}

An App is the definition of a graphical application. Apps can have multiple windows, it will exit when the first window to be shown is closed. You can also cause the app to exit by calling Quit(). To start an application you need to call Run() somewhere in your main() function. Alternatively use the window.ShowAndRun() function for your main window.

func CurrentApp added in v1.0.0

func CurrentApp() App

CurrentApp returns the current application, for which there is only 1 per process.

type Canvas added in v1.0.0

type Canvas interface {
	Content() CanvasObject
	SetContent(CanvasObject)
	Refresh(CanvasObject)
	Focus(Focusable)
	Focused() Focusable

	Size() Size
	Scale() float32
	SetScale(float32)

	OnTypedRune() func(rune)
	SetOnTypedRune(func(rune))
	OnTypedKey() func(*KeyEvent)
	SetOnTypedKey(func(*KeyEvent))
	AddShortcut(shortcut Shortcut, handler func(shortcut Shortcut))
}

Canvas defines a graphical canvas to which a CanvasObject or Container can be added. Each canvas has a scale which is automatically applied during the render process.

type CanvasObject added in v1.0.0

type CanvasObject interface {
	// geometry
	Size() Size
	Resize(Size)
	Position() Position
	Move(Position)
	MinSize() Size

	// visibility
	Visible() bool
	Show()
	Hide()
}

CanvasObject describes any graphical object that can be added to a canvas. Objects have a size and position that can be controlled through this API. MinSize is used to determine the minimum size which this object should be displayed. An object will be visible by default but can be hidden with Hide() and re-shown with Show().

Note: If this object is controlled as part of a Layout you should not call Resize(Size) or Move(Position).

type Clipboard added in v1.0.0

type Clipboard interface {
	// Content returns the clipboard content
	Content() string
	// SetContent sets the clipboard content
	SetContent(content string)
}

Clipboard represents the system clipboard interface

type Container added in v1.0.0

type Container struct {
	Hidden bool // Is this Container hidden

	Layout  Layout         // The Layout algorithm for arranging child CanvasObjects
	Objects []CanvasObject // The set of CanvasObjects this container holds
	// contains filtered or unexported fields
}

Container is a CanvasObject that contains a collection of child objects. The layout of the children is set by the specified Layout.

func NewContainer added in v1.0.0

func NewContainer(objects ...CanvasObject) *Container

NewContainer returns a new Container instance holding the specified CanvasObjects.

func NewContainerWithLayout added in v1.0.0

func NewContainerWithLayout(layout Layout, objects ...CanvasObject) *Container

NewContainerWithLayout returns a new Container instance holding the specified CanvasObjects which will be laid out according to the specified Layout.

func (*Container) AddObject added in v1.0.0

func (c *Container) AddObject(o CanvasObject)

AddObject adds another CanvasObject to the set this Container holds.

func (*Container) Hide added in v1.0.0

func (c *Container) Hide()

Hide sets this container, and all its children, to be not visible.

func (*Container) MinSize added in v1.0.0

func (c *Container) MinSize() Size

MinSize calculates the minimum size of a Container. This is delegated to the Layout, if specified, otherwise it will mimic MaxLayout.

func (*Container) Move added in v1.0.0

func (c *Container) Move(pos Position)

Move the container (and all its children) to a new position, relative to its parent.

func (*Container) Position added in v1.0.0

func (c *Container) Position() Position

Position gets the current position of this Container, relative to its parent.

func (*Container) Resize added in v1.0.0

func (c *Container) Resize(size Size)

Resize sets a new size for the Container.

func (*Container) Show added in v1.0.0

func (c *Container) Show()

Show sets this container, and all its children, to be visible.

func (*Container) Size added in v1.0.0

func (c *Container) Size() Size

Size returns the current size of this container.

func (*Container) Visible added in v1.0.0

func (c *Container) Visible() bool

Visible returns true if the container is currently visible, false otherwise.

type Driver added in v1.0.0

type Driver interface {
	// Create a new UI Window.
	CreateWindow(string) Window
	// Get a slice containing all app windows.
	AllWindows() []Window

	// Return the size required to render the given string of specified
	// font size and style.
	RenderedTextSize(string, int, TextStyle) Size

	// Get the canvas that is associated with a given CanvasObject.
	CanvasForObject(CanvasObject) Canvas

	// Start the main event loop of the driver.
	Run()
	// Close the driver and open windows then exit the application.
	Quit()
}

Driver defines an abstract concept of a Fyne render driver. Any implementation must provide at least these methods.

type Focusable added in v1.0.0

type Focusable interface {
	FocusGained()
	FocusLost()
	Focused() bool

	TypedRune(rune)
	TypedKey(*KeyEvent)
}

Focusable describes any CanvasObject that can respond to being focused. It will receive the FocusGained and FocusLost events appropriately. When focused it will also have TypedRune called as text is input and TypedKey called when other keys are pressed.

type KeyEvent added in v1.0.0

type KeyEvent struct {
	Name KeyName
}

KeyEvent describes a keyboard input event.

type KeyName added in v1.0.0

type KeyName string

KeyName represents the name of a key that has been pressed

const (
	// KeyEscape is the "esc" key
	KeyEscape KeyName = "Escape"
	// KeyReturn is the carriage return (main keyboard)
	KeyReturn KeyName = "Return"
	// KeyTab is the tab advance key
	KeyTab KeyName = "Tab"
	// KeyBackspace is the delete-before-cursor key
	KeyBackspace KeyName = "BackSpace"
	// KeyInsert is the insert mode key
	KeyInsert KeyName = "Insert"
	// KeyDelete is the delete-after-cursor key
	KeyDelete KeyName = "Delete"
	// KeyRight is the right arrow key
	KeyRight KeyName = "Right"
	// KeyLeft is the left arrow key
	KeyLeft KeyName = "Left"
	// KeyDown is the down arrow key
	KeyDown KeyName = "Down"
	// KeyUp is the up arrow key
	KeyUp KeyName = "Up"
	// KeyPageUp is the page up num-pad key
	KeyPageUp KeyName = "Prior"
	// KeyPageDown is the page down num-pad key
	KeyPageDown KeyName = "Next"
	// KeyHome is the line-home key
	KeyHome KeyName = "Home"
	// KeyEnd is the line-end key
	KeyEnd KeyName = "End"

	// KeyF1 is the first function key
	KeyF1 KeyName = "F1"
	// KeyF2 is the second function key
	KeyF2 KeyName = "F2"
	// KeyF3 is the third function key
	KeyF3 KeyName = "F3"
	// KeyF4 is the fourth function key
	KeyF4 KeyName = "F4"
	// KeyF5 is the fifth function key
	KeyF5 KeyName = "F5"
	// KeyF6 is the sixth function key
	KeyF6 KeyName = "F6"
	// KeyF7 is the seventh function key
	KeyF7 KeyName = "F7"
	// KeyF8 is the eighth function key
	KeyF8 KeyName = "F8"
	// KeyF9 is the ninth function key
	KeyF9 KeyName = "F9"
	// KeyF10 is the tenth function key
	KeyF10 KeyName = "F10"
	// KeyF11 is the eleventh function key
	KeyF11 KeyName = "F11"
	// KeyF12 is the twelfth function key
	KeyF12 KeyName = "F12"

	// KeyEnter is the enter/ return key (keypad)
	KeyEnter KeyName = "KP_Enter"

	// Key0 represents the key 0
	Key0 KeyName = "0"
	// Key1 represents the key 1
	Key1 KeyName = "1"
	// Key2 represents the key 2
	Key2 KeyName = "2"
	// Key3 represents the key 3
	Key3 KeyName = "3"
	// Key4 represents the key 4
	Key4 KeyName = "4"
	// Key5 represents the key 5
	Key5 KeyName = "5"
	// Key6 represents the key 6
	Key6 KeyName = "6"
	// Key7 represents the key 7
	Key7 KeyName = "7"
	// Key8 represents the key 8
	Key8 KeyName = "8"
	// Key9 represents the key 9
	Key9 KeyName = "9"
	// KeyA represents the key A
	KeyA KeyName = "A"
	// KeyB represents the key B
	KeyB KeyName = "B"
	// KeyC represents the key C
	KeyC KeyName = "C"
	// KeyD represents the key D
	KeyD KeyName = "D"
	// KeyE represents the key E
	KeyE KeyName = "E"
	// KeyF represents the key F
	KeyF KeyName = "F"
	// KeyG represents the key G
	KeyG KeyName = "G"
	// KeyH represents the key H
	KeyH KeyName = "H"
	// KeyI represents the key I
	KeyI KeyName = "I"
	// KeyJ represents the key J
	KeyJ KeyName = "J"
	// KeyK represents the key K
	KeyK KeyName = "K"
	// KeyL represents the key L
	KeyL KeyName = "L"
	// KeyM represents the key M
	KeyM KeyName = "M"
	// KeyN represents the key N
	KeyN KeyName = "N"
	// KeyO represents the key O
	KeyO KeyName = "O"
	// KeyP represents the key P
	KeyP KeyName = "P"
	// KeyQ represents the key Q
	KeyQ KeyName = "Q"
	// KeyR represents the key R
	KeyR KeyName = "R"
	// KeyS represents the key S
	KeyS KeyName = "S"
	// KeyT represents the key T
	KeyT KeyName = "T"
	// KeyU represents the key U
	KeyU KeyName = "U"
	// KeyV represents the key V
	KeyV KeyName = "V"
	// KeyW represents the key W
	KeyW KeyName = "W"
	// KeyX represents the key X
	KeyX KeyName = "X"
	// KeyY represents the key Y
	KeyY KeyName = "Y"
	// KeyZ represents the key Z
	KeyZ KeyName = "Z"
)

type Layout added in v1.0.0

type Layout interface {
	// Layout will manipulate the listed CanvasObjects Size and Position
	// to fit within the specified size.
	Layout([]CanvasObject, Size)
	// MinSize calculates the smallest size that will fit the listed
	// CanvasObjects using this Layout algorithm.
	MinSize(objects []CanvasObject) Size
}

Layout defines how CanvasObjects may be laid out in a specified Size.

type PointEvent added in v1.0.0

type PointEvent struct {
	Position Position // The position of the event
}

PointEvent describes a pointer input event. The position is relative to the top-left of the CanvasObject this is triggered on.

type Position added in v1.0.0

type Position struct {
	X int // The position from the parent' left edge
	Y int // The position from the parent's top edge
}

Position describes a generic X, Y coordinate relative to a parent Canvas or CanvasObject.

func NewPos added in v1.0.0

func NewPos(x int, y int) Position

NewPos returns a newly allocated Position representing the specified coordinates.

func (Position) Add added in v1.0.0

func (p1 Position) Add(p2 Position) Position

Add returns a new Position that is the result of offsetting the current position by p2 X and Y.

func (Position) Subtract added in v1.0.0

func (p1 Position) Subtract(p2 Position) Position

Subtract returns a new Position that is the result of offsetting the current position by p2 -X and -Y.

type Resource added in v1.0.0

type Resource interface {
	Name() string
	Content() []byte
}

Resource represents a single binary resource, such as an image or font. A resource has an identifying name and byte array content. The serialised path of a resource can be obtained which may result in a blocking filesystem write operation.

type ScrollEvent added in v1.0.0

type ScrollEvent struct {
	PointEvent
	DeltaX, DeltaY int
}

ScrollEvent defines the parameters of a pointer or other scroll event. The DeltaX and DeltaY represent how large the scroll was in two dimensions.

type Scrollable added in v1.0.0

type Scrollable interface {
	Scrolled(*ScrollEvent)
}

Scrollable describes any CanvasObject that can also be scrolled. This is mostly used to implement the widget.ScrollContainer.

type Settings added in v1.0.0

type Settings interface {
	Theme() Theme
	SetTheme(Theme)

	AddChangeListener(chan Settings)
}

Settings describes the application configuration available.

type Shortcut added in v1.0.0

type Shortcut interface {
	ShortcutName() string
}

Shortcut is the interface used to describe a shortcut action

type ShortcutCopy added in v1.0.0

type ShortcutCopy struct {
	Clipboard Clipboard
}

ShortcutCopy describes a shortcut copy action.

func (*ShortcutCopy) ShortcutName added in v1.0.0

func (se *ShortcutCopy) ShortcutName() string

ShortcutName returns the shortcut name

type ShortcutCut added in v1.0.0

type ShortcutCut struct {
	Clipboard Clipboard
}

ShortcutCut describes a shortcut cut action.

func (*ShortcutCut) ShortcutName added in v1.0.0

func (se *ShortcutCut) ShortcutName() string

ShortcutName returns the shortcut name

type ShortcutHandler added in v1.0.0

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

ShortcutHandler is a default implementation of the shortcut handler for the canvasObject

func (*ShortcutHandler) AddShortcut added in v1.0.0

func (sh *ShortcutHandler) AddShortcut(shortcut Shortcut, handler func(shortcut Shortcut))

AddShortcut register an handler to be executed when the shortcut action is triggered

func (*ShortcutHandler) TypedShortcut added in v1.0.0

func (sh *ShortcutHandler) TypedShortcut(shortcut Shortcut) bool

TypedShortcut handle the registered shortcut

type ShortcutPaste added in v1.0.0

type ShortcutPaste struct {
	Clipboard Clipboard
}

ShortcutPaste describes a shortcut paste action.

func (*ShortcutPaste) ShortcutName added in v1.0.0

func (se *ShortcutPaste) ShortcutName() string

ShortcutName returns the shortcut name

type Shortcutable added in v1.0.0

type Shortcutable interface {
	TypedShortcut(shortcut Shortcut) bool
}

Shortcutable describes any CanvasObject that can respond to shortcut commands (quit, cut, copy, and paste).

type Size added in v1.0.0

type Size struct {
	Width  int // The number of units along the X axis.
	Height int // The number of units along the Y axis.
}

Size describes something with width and height.

func NewSize added in v1.0.0

func NewSize(w int, h int) Size

NewSize returns a newly allocated Size of the specified dimensions.

func (Size) Add added in v1.0.0

func (s1 Size) Add(s2 Size) Size

Add returns a new Size that is the result of increasing the current size by s2 Width and Height.

func (Size) Subtract added in v1.0.0

func (s1 Size) Subtract(s2 Size) Size

Subtract returns a new Size that is the result of decreasing the current size by s2 Width and Height.

func (Size) Union added in v1.0.0

func (s1 Size) Union(s2 Size) Size

Union returns a new Size that is the maximum of the current Size and s2.

type StaticResource added in v1.0.0

type StaticResource struct {
	StaticName    string
	StaticContent []byte
}

StaticResource is a bundled resource compiled into the application. These resources are normally generated by the fyne_bundle command included in the Fyne toolkit.

func NewStaticResource added in v1.0.0

func NewStaticResource(name string, content []byte) *StaticResource

NewStaticResource returns a new static resource object with the specified name and content. Creating a new static resource in memory results in sharable binary data that may be serialised to the location returned by CachePath().

func (*StaticResource) Content added in v1.0.0

func (r *StaticResource) Content() []byte

Content returns the bytes of the bundled resource, no compression is applied but any compression on the resource is retained.

func (*StaticResource) GoString added in v1.0.0

func (r *StaticResource) GoString() string

GoString converts a Resource object to Go code. This is useful if serialising to a Go file for compilation into a binary.

func (*StaticResource) Name added in v1.0.0

func (r *StaticResource) Name() string

Name returns the unique name of this resource, usually matching the file it was generated from.

type Tappable added in v1.0.0

type Tappable interface {
	Tapped(*PointEvent)
	TappedSecondary(*PointEvent)
}

Tappable describes any CanvasObject that can also be tapped. This should be implemented by buttons etc that wish to handle pointer interactions.

type TextAlign added in v1.0.0

type TextAlign int

TextAlign represents the horizontal alignment of text within a widget or canvas object.

const (
	// TextAlignLeading specifies a left alignment for left-to-right languages.
	TextAlignLeading TextAlign = iota
	// TextAlignCenter places the text centrally within the available space.
	TextAlignCenter
	// TextAlignTrailing will align the text right for a left-to-right language.
	TextAlignTrailing
)

type TextStyle added in v1.0.0

type TextStyle struct {
	Bold      bool // Should text be bold
	Italic    bool // Should text be italic
	Monospace bool // Use the system monospace font instead of regular
}

TextStyle represents the styles that can be applied to a text canvas object or text based widget.

type Theme added in v1.0.0

type Theme interface {
	BackgroundColor() color.Color
	ButtonColor() color.Color
	HyperlinkColor() color.Color
	TextColor() color.Color
	PlaceHolderColor() color.Color
	PrimaryColor() color.Color
	FocusColor() color.Color
	ScrollBarColor() color.Color

	TextSize() int
	TextFont() Resource
	TextBoldFont() Resource
	TextItalicFont() Resource
	TextBoldItalicFont() Resource
	TextMonospaceFont() Resource

	Padding() int
	IconInlineSize() int
	ScrollBarSize() int
}

Theme defines the requirements of any Fyne theme.

type Themeable added in v1.0.0

type Themeable interface {
	ApplyTheme()
}

Themeable indicates that the associated CanvasObject responds to theme changes. When the settings detect a theme change the object will be informed through the invocation of ApplyTheme().

type Widget added in v1.0.0

type Widget interface {
	CanvasObject

	CreateRenderer() WidgetRenderer
}

Widget defines the standard behaviours of any widget. This extends the CanvasObject - a widget behaves in the same basic way but will encapsulate many child objects to create the rendered widget.

type WidgetRenderer added in v1.0.0

type WidgetRenderer interface {
	Layout(Size)
	MinSize() Size

	Refresh()
	ApplyTheme()
	BackgroundColor() color.Color
	Objects() []CanvasObject
	Destroy()
}

WidgetRenderer defines the behaviour of a widget's implementation. This is returned from a widget's declarative object through the Render() function and should be exactly one instance per widget in memory.

type Window

type Window interface {
	// Title returns the current window title.
	// This is typically displayed in the window decorations.
	Title() string
	// SetTitle updates the current title of the window.
	SetTitle(string)

	// FullScreen returns whether or not this window is currently full screen.
	FullScreen() bool
	// SetFullScreen changes the requested fullScreen property
	// true for a fullScreen window and false to unset this.
	SetFullScreen(bool)

	// Resize this window to the requested content size.
	// The result may not be exactly as desired due to various desktop or
	// platform constraints.
	Resize(Size)

	// RequestFocus attempts to raise and focus this window.
	// This should only be called when you are sure the user would want this window
	// to steal focus from any current focused window.
	RequestFocus()

	// FixedSize returns whether or not this window should disable resizing.
	FixedSize() bool
	// SetFixedSize sets a hint that states whether the window should be a fixed
	// size or allow resizing.
	SetFixedSize(bool)

	// CenterOnScreen places a window at the center of the monitor
	// the Window object is currently positioned on.
	CenterOnScreen()

	// Padded, normally true, states whether the window should have inner
	// padding so that components do not touch the window edge.
	Padded() bool
	// SetPadded allows applications to specify that a window should have
	// no inner padding. Useful for fullscreen or graphic based applications.
	SetPadded(bool)

	// Icon returns the window icon, this is used in various ways
	// depending on operating system.
	// Most commonly this is displayed on the window border or task switcher.
	Icon() Resource

	// SetIcon sets the icon resource used for this window.
	// If none is set should return the application icon.
	SetIcon(Resource)

	SetOnClosed(func())

	// Show the window on screen.
	Show()
	// Hide the window from the user.
	// This will not destroy the window or cause the app to exit.
	Hide()
	// Close the window.
	// If it is the only open window, or the "master" window the app will Quit.
	Close()

	// ShowAndRun is a shortcut to show the window and then run the application.
	// This should be called near the end of a main() function as it will block.
	ShowAndRun()

	// Content returns the content of this window.
	Content() CanvasObject
	// SetContent sets the content of this window.
	SetContent(CanvasObject)
	// Canvas returns the canvas context to render in the window.
	// This can be useful to set a key handler for the window, for example.
	Canvas() Canvas

	//Clipboard returns the system clipboard
	Clipboard() Clipboard
}

Window describes a user interface window. Depending on the platform an app may have many windows or just the one.

Directories

Path Synopsis
Package app provides app implementations for working with Fyne graphical interfaces.
Package app provides app implementations for working with Fyne graphical interfaces.
Package canvas contains all of the primitive CanvasObjects that make up a Fyne GUI
Package canvas contains all of the primitive CanvasObjects that make up a Fyne GUI
cmd
fyne
Run a command line helper for various Fyne tools.
Run a command line helper for various Fyne tools.
fyne_demo
Package main provides various examples of Fyne API capabilities
Package main provides various examples of Fyne API capabilities
hello
Package main loads a very basic Hello World graphical application
Package main loads a very basic Hello World graphical application
Package dialog defines standard dialog windows for application GUIs
Package dialog defines standard dialog windows for application GUIs
driver
gl
Package gl provides a full Fyne render implementation using system OpenGL libraries.
Package gl provides a full Fyne render implementation using system OpenGL libraries.
Package layout defines the various layouts available to Fyne apps
Package layout defines the various layouts available to Fyne apps
Package test provides utility drivers for running UI tests without rendering
Package test provides utility drivers for running UI tests without rendering
Package theme defines how a Fyne app should look when rendered
Package theme defines how a Fyne app should look when rendered
Package widget defines the UI widgets within the Fyne toolkit
Package widget defines the UI widgets within the Fyne toolkit

Jump to

Keyboard shortcuts

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