Closed shackra closed 9 years ago
ShowAll
is a method of gtk.Widget
. You will have to type assert the mainwindow
variable from a glib.IObject
(an interface which can pack any object) to the actual type which implements that method. In this case that would probably be a *gtk.Window
.
BTW, your example program is incorrect since it does not run the GTK event loop (with gtk.Main
) and will immediately close.
To expand on what @jrick said:
mainwindowobj, _ := builder.GetObject("MainWindow1")
mainwindow, ok := mainwindowobj.(*gtk.Window)
if !ok {
fmt.Println("wrong type")
return
}
mainwindow.Connect("destroy", func() {
gtk.MainQuit()
})
mainwindow.ShowAll()
Oh, oops! I need to choose the simpler window instead:
2015/01/24 00:31:08 Error at getting the Window object: unrecognized class name 'GtkApplicationWindow'
Thanks, I didn't know how to work around this issue :)
I'm trying to use a designed interface with Glade in my Go application, like this:
But it seems that is not working, I get the following error: