diff options
| author | Jeff Carr <[email protected]> | 2021-10-06 10:59:22 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2021-10-06 10:59:22 -0500 |
| commit | b40030a6b11a74a0ba1cb34d1eb12d49a3d3ed44 (patch) | |
| tree | 17dcb67c4f6a6ce3330edd27d65533e853f5660d /gui-example/main.go | |
| parent | f11db8e7779a55b9dac277243dd3c4fe6fbd9a2e (diff) | |
EXAMPLE: provide a clean example
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'gui-example/main.go')
| -rw-r--r-- | gui-example/main.go | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/gui-example/main.go b/gui-example/main.go new file mode 100644 index 0000000..f3e4c48 --- /dev/null +++ b/gui-example/main.go @@ -0,0 +1,43 @@ +package main + +import ( + "log" + "os" + "time" + + "git.wit.org/wit/gui" +) + +func customExit(gw *gui.GuiWindow) { + log.Println("Should Exit Here") + os.Exit(0) +} + +func main() { + log.Println("starting my Control Panel") + + gui.Config.Width = 1000 + gui.Config.Height = 400 + gui.Config.Exit = customExit + + go gui.Main(initGUI) + + watchGUI() +} + +func initGUI() { + gui.NewWindow("jcarr start", 640, 480) +} + +func watchGUI() { + var i = 1 + for { + log.Println("Waiting for customExit()", i) + i += 1 + time.Sleep(time.Second) + if i == 3 { + log.Println("Sending ExampleWindow to gui.Queue()") + gui.Queue(gui.ExampleWindow) + } + } +} |
