HOME

TheInfoList



OR:

Fyne is a
free and open-source Free and open-source software (FOSS) is a term used to refer to groups of software consisting of both free software and open-source software where anyone is freely licensed to use, copy, study, and change the software in any way, and the source ...
cross-platform In computing, cross-platform software (also called multi-platform software, platform-agnostic software, or platform-independent software) is computer software that is designed to work in several computing platforms. Some cross-platform software ...
widget toolkit A widget toolkit, widget library, GUI toolkit, or UX library is a library or a collection of libraries containing a set of graphical control elements (called ''widgets'') used to construct the graphical user interface (GUI) of programs. Most wid ...
for creating
graphical user interface The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows User (computing), users to Human–computer interaction, interact with electronic devices through graphical icon (comp ...
s (GUIs) across desktop and mobile platforms. Fyne uses OpenGL to provide cross-platform graphics. It is inspired by the principles of
Material Design Material Design (codenamed Quantum Paper) is a design language developed by Google in 2014. Expanding on the "cards" that debuted in Google Now, Material Design uses more grid-based layouts, responsive animations and transitions, padding, and ...
to create applications that look and behave consistently across all platforms. It is licensed under the terms of the
3-clause BSD License BSD licenses are a family of permissive free software licenses, imposing minimal restrictions on the use and distribution of covered software. This is in contrast to copyleft licenses, which have share-alike requirements. The original BSD lic ...
, supporting the creation of
free Free may refer to: Concept * Freedom, having the ability to do something, without having to obey anyone/anything * Freethought, a position that beliefs should be formed only on the basis of logic, reason, and empiricism * Emancipate, to procur ...
and proprietary applications. In December 2019 Fyne became the most popular GUI toolkit for Go, by GitHub star count and in early February 2020 it was trending as #1 project in GitHub trending ranks.


Development

Fyne is currently developed by a team of volunteers and is supported by around 40 contributors. Members of this group also work on the FyneDesk project to create a new
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which i ...
desktop environment In computing, a desktop environment (DE) is an implementation of the desktop metaphor made of a bundle of programs running on top of a computer operating system that share a common graphical user interface (GUI), sometimes described as a graphi ...
. The Fyne toolkit is written primarily in Go. The team focuses on clean APIs and follows the principles of
Clean Code Solid is one of the four fundamental states of matter (the others being liquid, gas, and plasma). The molecules in a solid are closely packed together and contain the least amount of kinetic energy. A solid is characterized by structural ...
to sustain maintainability of the project. All Fyne projects are continuously tested to check correctness, stability as well as formatting and documentation.


Example

The code required for a simple "Hello World" application is minimal, as follows: package main import ( "fyne.io/fyne/v2/app" "fyne.io/fyne/v2/container" "fyne.io/fyne/v2/widget" ) func main() To build this application you will need the Go language and a C compiler installed, as well as a graphics driver that supports
OpenGL OpenGL (Open Graphics Library) is a cross-language, cross-platform application programming interface (API) for rendering 2D and 3D vector graphics. The API is typically used to interact with a graphics processing unit (GPU), to achieve ha ...
. It can be built and run using the command: $ go run main.go


Design

Design of the Fyne API and user interface components follows a careful process to ensure the simplicity. The Fyne toolkit is built in various layers, with each in separate packages. Notable layers include:


API

API An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how ...
, or Application programming interface, is an interface or protocol that allows for communication across different parts of the software. Fyne has a self-documenting API that is also extensible resulting in the ability for each developer to create custom tools unique to their project that will mesh with Fyne itself.


Vector graphics

The use of
vector graphics Vector graphics is a form of computer graphics in which visual images are created directly from geometric shapes defined on a Cartesian plane, such as points, lines, curves and polygons. The associated mechanisms may include vector display ...
to paint the UI provides a method of adapting to different device and display sizes without losing image fidelity. This allows the programmer to only need to create the UI once and it will look as expected on any device.


Hierarchy


Canvas

Canvas contains all of the contents of a window ranging from the full screen to a group of CanvasObjects.


CanvasObject

CanvasObjects are what actually get rendered on screen such as Text, Rectangle, Line. The objects store size, position and color information for the rendering process.


Container

Containers are groups of CanvasObjects, each container can specify a layout which will contain the sizing and position of its child components. Layouts help the developer arrange components in a manner that response to the container or window size, with several layout types provided including Border, Center, and Grid.


Widget

All of the components of a window in a CanvasObject are widgets that contain standard user interface elements. Fyne widgets include but are not limited to UI basics such as: Button, Check, Form, Hyperlink, Label, Radio, Select and Toolbar as well as container widgets like AppTabs and Split. Since 1.4 there are additional collection widgets that provide high-performance presentation of large data in a List, Table or Tree view. All the built-in UI widgets ensure that standard aspects of GUI interactivity act in a predictable and expected way across applications. This helps improve quality of programs while assisting the programmer by removing the need for them to create these tools themself.


Packages

All components of Fyne are split into packages and then connected via the API to create a final GUI application. In addition to the canvas, layout, and widget packages, notable packages include: * App package which is the main entry point for the app which manages understanding the type of device the application is running on and ensures the code will run as expected on that device. * Test package enabling
test-driven development Test-driven development (TDD) is a software development process relying on software requirements being converted to test cases before software is fully developed, and tracking all software development by repeatedly testing the software against a ...
to validate the GUI itself functions as expected.


Use

The largest project currently using the Fyne toolkit is the FyneDesk project, a complete desktop environment for Linux. There are many other applications being built using the toolkit, those that are open source can be found in an application listing website managed by the project. Many businesses are using the Fyne toolkit to quickly add a graphical user interface to command line tools which they have already built using Go.


References


Bibliography

* * *


External links

*
Fyne tour

Developer guides

GoDoc documentation
{{Widget toolkits Application programming interfaces Widget toolkits