Exemple #1
0
func main() {
	go ui.Do(func() {
		name := ui.NewTextField()
		button := ui.NewButton("greet")
		greeting := ui.NewLabel("")

		stack := ui.NewVerticalStack(
			ui.NewLabel("name:"),
			name,
			button,
			greeting)

		window = ui.NewWindow("hello world", 200, 100, stack)

		button.OnClicked(func() {
			greeting.SetText("hello, " + name.Text() + "!")
		})

		window.OnClosing(func() bool {
			ui.Stop()
			return true
		})

		window.Show()
	})

	err := ui.Go()
	if err != nil {
		panic(err)
	}
}
Exemple #2
0
func main() {
	go ui.Do(initGUI)
	err := ui.Go()
	if err != nil {
		panic(err)
	}
}
Exemple #3
0
func main() {
	go ui.Do(gui)
	err := ui.Go()
	if err != nil {
		log.Print(err)
	}
}
Exemple #4
0
func main() {
	// This runs the code that displays our GUI.
	// All code that interfaces with package ui (except event handlers) must be run from within a ui.Do() call.
	go ui.Do(gui)

	err := ui.Go()
	if err != nil {
		log.Print(err)
	}
}
Exemple #5
0
func main() {
	var err error
	current, err = fetchLatest()
	if err != nil {
		log.Fatalf("Error : %v\n", err)
	}
	go ui.Do(initGui)
	err = ui.Go()
	if err != nil {
		log.Fatalf("Error : %v\n", err)
	}
}
Exemple #6
0
func main() {
	if len(os.Args) != 1 {
		t := getJSON(getWords())
		fmt.Println(simple(t))
	} else {
		go ui.Do(gui)
		err := ui.Go()
		if err != nil {
			panic(err)
		}
	}
}
Exemple #7
0
func main() {
	simulation.Init()

	timer_10ms := time.Tick(10 * time.Millisecond)

	go ui.Do(func() {
		widthFloat := float64(inWidth * dpi)
		heightFloat := float64(inHeight * dpi)
		width := int(widthFloat)
		height := int(heightFloat)

		// Give ourselves a drawable canvas:
		canvas := &canvasArea{
			img: image.NewRGBA(image.Rect(0, 0, width, height)),
		}
		area := ui.NewArea(width, height, canvas)
		w := ui.NewWindow("e-minor v2", width+8*2, height+28*2, area)
		w.SetMargined(false)
		w.OnClosing(func() bool {
			ui.Stop()
			return true
		})

		w.Show()

		// This *should* be in the main UI message loop, but the 'ui' package does not expose the message loop.
		go func() {
			for {
				select {
				case <-timer_10ms:
					simulation.Timer_10msec()
				default:
					simulation.Handle()
				}
			}
		}()
	})

	err := ui.Go()
	if err != nil {
		panic(err)
	}
}
Exemple #8
0
func main() {
	go ui.Do(func() {
		textview := ui.NewTextbox()
		textview.SetText("asd")

		window = ui.NewWindow("Hello", 300, 300, textview)
		window.OnClosing(func() bool {
			ui.Stop()
			return true
		})

		window.Show()
	})
	go startListen()
	err := ui.Go()
	if err != nil {
		panic(err)
	}

}
Exemple #9
0
func main() {
	err := ui.Go(myMain)
	if err != nil {
		panic(fmt.Errorf("error initializing UI library: %v", err))
	}
}