Skip to content
Randall O'Reilly edited this page Nov 8, 2019 · 1 revision

This page contains misc gui tips for using GoGi in emergent simulations.

Adding Menu to Toolbar

If you get too many actions in your toolbar, it can be a good idea to organize them into menus. Here's some sample code to do that:

	smen := gi.AddNewMenuButton(tbar, "step")
	smen.SetText("Step")

	smen.Menu.AddAction(gi.ActOpts{Label: "Step Trial", Icon: "step-fwd", Tooltip: "Advances one training trial at a time.", UpdateFunc: func(act *gi.Action) {
		act.SetActiveStateUpdt(!ss.IsRunning)
	}}, win.This(), func(recv, send ki.Ki, sig int64, data interface{}) {
		if !ss.IsRunning {
			ss.IsRunning = true
			ss.TrainTrial()
			ss.IsRunning = false
			vp.SetNeedsFullRender()
		}
	})
       ....