mattn / go-gtk

Go binding for GTK
http://mattn.github.com/go-gtk
BSD 3-Clause "New" or "Revised" License
2.11k stars 247 forks source link

Excuse me, why didn't I load the WINDOW from glade? #375

Open xiang136 opened 6 years ago

xiang136 commented 6 years ago

window := gtk.WindowFromObject(builder.GetObject("window1")) You can't find the gtk. Windows fromobject () method.

mattn commented 6 years ago

please show me your code.

ploynomail commented 5 years ago

func (obj *Chessboard) CreateWindow() { //加载glade文件 builder := gtk.NewBuilder() builder.AddFromFile("ui.glade")

//窗口相关
obj.window = gtk.Window(builder.GetObject("window1"))
obj.window.SetAppPaintable(true)
obj.window.SetPosition(gtk.WIN_POS_CENTER)
obj.w, obj.h = 800, 480                                         
obj.window.SetSizeRequest(800, 480)                
obj.window.SetDecorated(false)                          

obj.window.SetEvents(int(gdk.BUTTON_PRESS_MASK | gdk.BUTTON1_MOTION_MASK))

}

ploynomail commented 5 years ago

I have the same problem, thank you.

renhe134880 commented 5 years ago

I have the same problem,ありがとう

Ultronxr commented 5 years ago

I have the same problem, my Go version is go version go1.12.1 windows/amd64. I have reinstall my environment including tool-chain , glade for several times but still not work. Please help me.

alwang121212 commented 5 years ago

""undefined: gtk.WindowFromObject"" This is the error message I got.

mengjian110 commented 4 years ago

I have the same problem,thank you

YJ-L-2017 commented 4 years ago

I have the same problem, ""undefined: gtk.WindowFromObject""

mattn commented 4 years ago

Did you read installation instruction?

https://github.com/mattn/go-gtk#install