Skip to content

Instantly share code, notes, and snippets.

@asukakenji
Created July 31, 2017 17:18
Show Gist options
  • Save asukakenji/8126ab4463091fb1e05255a509dfa8e3 to your computer and use it in GitHub Desktop.
Save asukakenji/8126ab4463091fb1e05255a509dfa8e3 to your computer and use it in GitHub Desktop.
Shortest GUI program written in Golang. It displays a window and exits after 5 seconds.
// Shortest GUI program written in Golang.
// It displays a window and exits after 5 seconds.
package main
import (
"time"
"golang.org/x/exp/shiny/driver"
"golang.org/x/exp/shiny/screen"
)
func main() {
driver.Main(func(s screen.Screen) {
w, err := s.NewWindow(nil)
if err != nil {
panic(err)
}
defer w.Release()
w.Publish()
time.Sleep(5 * time.Second)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment