func closeDialog(dlg *gtk.Dialog) { dlg.Destroy() /* The Destroy call itself isn't enough to remove the dialog from the screen; apparently ** that happens once the GTK main loop processes some further events. But if we're ** in a non-GTK app the main loop isn't running, so we empty the event queue before ** returning from the dialog functions. ** Not sure how this interacts with an actual GTK app... */ for gtk.EventsPending() { gtk.MainIteration() } }
func calc_ai() { stopClick = true info.SetLabel("AI is thinking") for gtk.EventsPending() { gtk.MainIteration() } x, y := IATurn(&game) _, vic := event_play(x, y) stopClick = false info.SetLabel("AI is proud") if vic == 0 && hint { calcHint <- true } }