Rye-Fyne

Cross-platform GUI applications with the Rye language and the Fyne toolkit

About Rye-Fyne

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.

Screenshots

A selection of apps and examples built with Rye-Fyne:

Quick code examples

Hello Fyne World — minimal app
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
Button with callback
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
Live clock — goroutine GUI updates
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
1 million item list — performant virtual list
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

Get my IP — HTTP, clipboard, failure handling
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
Tabbed settings panel — tabs, sliders, controls
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

What you can build

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

Delve deeper

Explore Rye-Fyne through examples, documentation and live development:

ExamplesUpdated examples with the new import system — Hello World to Movie Database
Mobile appsBuilding Rye-Fyne apps for Android and iOS

Get Rye-Fyne

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
LinuxLatest release
macOSLatest release
WindowsLatest release
Build from sourcegit clone https://github.com/refaktor/rye-fyne && cd rye-fyne && go build

Key features of the integration

  • Automatic bindings — generated by ryegen, following Fyne API closely
  • Explicit Go importsimport\go "fyne/widget" for clarity and explorable contexts
  • Goroutine support — live GUI updates from parallel code using fyne/do
  • Cross-platform — same code runs on Linux, macOS, Windows and mobile
  • Rye's expressiveness — pipe-words, op-words and code-as-data make GUI code concise

Join

Interested in Rye-Fyne? Visit the GitHub repository, check out the examples, or join the Reddit group.