Edit me

Create your first Fyne app

Having completed the steps in the getting started document you’re ready to build your first app. To illustrate the process we will build a simple hello world application.

A simple app starts by creating an app instance with app.New() and then opening a window with app.NewWindow(). Then a widget tree is defined that is set as the main content with SetContent() on a window. The app UI is then shown by calling ShowAndRun() on the window.

  • Using Functions
  • Using Structs

The code above can be built using the command go build hello.go and then executed either by running the hello command or by double clicking the icon. You could also bypass the compiling step and just run the code directly using go run hello.go.

Either approach will show a window that looks just like this:

Hello Window

If you prefer a light theme then just set the environment variable FYNE_THEME=light and you’ll get:

Hello Light Theme

That’s all there is to getting started. To learn more you can read the full API documentation. If you prefer a curated process we have prepared a tour of the toolkit that you can launch using the button below.

Take the Tour