Cross-platform GUI applications with the Rye language and the Fyne toolkit
Rye-Fyne is a distribution of Rye extended with bindings for the Fyne GUI library. Fyne is a pure Go cross-platform toolkit that runs on Linux, macOS, Windows and mobile platforms (Android, iOS).
Rye-Fyne lets you write desktop and mobile GUI applications using Rye's expressive, high-level syntax. The bindings are automatically generated by ryegen and follow Fyne's API closely, so Fyne documentation translates naturally.
Rye's language features — code-as-data, goroutines, pipe and op-words — make GUI code concise and composable. Live development from the Rye console lets you prototype interfaces interactively.
A selection of apps and examples built with Rye-Fyne:
Quick code examples
fyne: import\go "fyne"
app: import\go "fyne/app"
widget: import\go "fyne/widget"
a: app/new
w: a .window "Hello"
w .set-content widget/label "Hello fyne world!"
w .show-and-run
fyne: import\go "fyne"
app: import\go "fyne/app"
widget: import\go "fyne/widget"
container: import\go "fyne/container"
layout: import\go "fyne/layout"
lab: widget/label "I'm Waiting ..."
btn: widget/button "Click here" does {
lab .set-text "Finally ..."
}
box: container/vbox [
lab
layout/spacer
btn
]
w: app/new .window "Button"
w .resize fyne/size 200.0 100.0
w .set-content box
w .show-and-run
fyne: import\go "fyne"
app: import\go "fyne/app"
widget: import\go "fyne/widget"
lab: widget/label ""
go does {
forever {
fyne/do does {
lab .set-text now .to-string
}
sleep 500
}
}
w: app/new .window "Date & Time"
w .set-content lab
w .show-and-run
fyne: import\go "fyne"
app: import\go "fyne/app"
widget: import\go "fyne/widget"
lst: widget/list
does { 1000000 }
does { widget/label "num" }
fn { i item } { item .set-text to-string i + 1 }
w: app/new .window "1 million list"
w .resize fyne/size 220.0 200.0
w .set-content lst
w .show-and-run
Practical apps
fyne: import\go "fyne"
app: import\go "fyne/app"
widget: import\go "fyne/widget"
container: import\go "fyne/container"
w: app/new .window "Get my IP"
url: https://ifconfig.me
lab: widget/label "retrieving ..."
btn: widget/button "Copy" fn { } {
w .clipboard .set-content lab .text?
}
get-ip: does {
Get url
|^fix { embed url "couldn't load {{}}" }
|html->markdown
|^fix { "couldn't parse html" }
|Submatch?* regexp "IP Address \*\*([0-9.]+)\*\*"
|^fix { "couldn't find the IP pattern" }
}
go does {
forever {
fyne/do does { lab .set-text get-ip }
sleep 1 .minutes
}
}
w .set-content container/hbox [ lab btn ]
w .show-and-run
fyne: import\go "fyne"
app: import\go "fyne/app"
widget: import\go "fyne/widget"
container: import\go "fyne/container"
theme: import\go "fyne/theme"
a: app/new
w: a .window "Settings Panel"
private {
volume-slider: widget/slider 0.0 100.0
volume-slider .set-value 75.0
volume-label: widget/label "Volume: 75%"
volume-slider .on-changed! fn { v } {
volume-label .set-text "Volume: " ++ v ++ "%"
}
notifications-check: widget/check "Enable notifications"
fn { v } { print "Notifications:" v }
notifications-check .set-checked true
container/vbox [
widget/label "Audio Settings"
volume-slider
volume-label
widget/separator
widget/label "Application Settings"
notifications-check
]
} :general-content
about-content: container/vbox [
widget/icon theme/info-icon
widget/label "Settings Demo v1.0.0"
]
tabs: container/app-tabs [
container/tab-item "General" general-content
container/tab-item "About" about-content
]
w .set-content tabs
w .resize fyne/size 400.0 350.0
w .show-and-run
Rye-Fyne gives you access to the full Fyne widget set and layout system. Here are some of the components available:
Labels Buttons Entries Password entries Selects Checkboxes Sliders Progress bars Lists Tables Tabs Forms Dialogs Rich text Canvas & Images Icons & Themes HBox / VBox Border layout Grid layout Goroutines Live REPL dev
Explore Rye-Fyne through examples, documentation and live development:
| Examples | Updated examples with the new import system — Hello World to Movie Database |
| Mobile apps | Building Rye-Fyne apps for Android and iOS |
Rye-Fyne examples won't work with regular Rye. You need the Rye-Fyne distribution which includes Fyne bindings. Download pre-built binaries or build from source:
| Download | |
|---|---|
| Linux | Latest release |
| macOS | Latest release |
| Windows | Latest release |
| Build from source | git clone https://github.com/refaktor/rye-fyne && cd rye-fyne && go build |
import\go "fyne/widget" for clarity and explorable contextsfyne/doInterested in Rye-Fyne? Visit the GitHub repository, check out the examples, or join the Reddit group.