Created
July 31, 2017 17:18
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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