TODO: make the docs correct at pkg.go.dev

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-03 22:57:28 -06:00
parent 2890eaab05
commit 92db003be0
2 changed files with 5 additions and 16 deletions

View File

@ -61,7 +61,7 @@ git.wit.org:
# sync repo to the github backup # sync repo to the github backup
# git remote add github git@github.com:wit-go/gui.git # git remote add github git@github.com:wit-go/gui.git
github: github: git.wit.org
git push origin master git push origin master
git push origin devel git push origin devel
git push origin --tags git push origin --tags

View File

@ -41,29 +41,18 @@ import (
"go.wit.com/wit/gui/gui" "go.wit.com/wit/gui/gui"
) )
var window *gui.Node // This is the beginning of the binary tree of widgets var myGui *gui.Node // This is your gui object
// go will sit here until the window exits // go will sit here until the window exits
func main() { func main() {
gui.Init() myGui = gui.Init()
gui.Main(helloworld)
} }
// This initializes the first window and 2 tabs // This initializes the first window and 2 tabs
func helloworld() { func helloworld() {
gui.Config.Title = "Hello World golang wit/gui Window" window := myGui.NewWindow()
gui.Config.Width = 640
gui.Config.Height = 480
window := gui.NewWindow() group := window.NewGroup("foo bar")
addTab(window, "A Simple Tab Demo")
addTab(window, "A Second Tab")
}
func addTab(w *gui.Node, title string) {
tab := w.NewTab(title)
group := tab.NewGroup("foo bar")
group.NewButton("hello", func() { group.NewButton("hello", func() {
log.Println("world") log.Println("world")
}) })