ATK Go 语言的 Tcl/Tk 绑定图形库 项目简介
ATK 是 Go 语言的 Tcl/Tk 绑定图形库。go get github.com/visualfc/atk安装 Tcl/Tkhttp://www.tcl-lang.orgMacOS X, Windowshttps://www.activestate.com/activetcl/downloadsUbuntu$ sudo apt install tk-devCentOS$ sudo yum install tk-develDemohttps://github.com/visualfc/atk_demoSamplepackage main
import (
"github.com/visualfc/atk/tk"
)
type Window struct {
*tk.Window
}
func NewWindow() *Window {
mw := &Window{tk.RootWindow()}
lbl := tk.NewLabel(mw, "Hello ATK")
btn := tk.NewButton(mw, "Quit")
btn.OnCommand(func() {
tk.Quit()
})
tk.NewVPackLayout(mw).AddWidgets(lbl, tk.NewLayoutSpacer(mw, 0, true), btn)
mw.ResizeN(300, 200)
return mw
}
func main() {
tk.MainLoop(func() {
mw := NewWindow()
mw.SetTitle("ATK Sample")
mw.Center()
mw.ShowNormal()
})
}
import (
"github.com/visualfc/atk/tk"
)
type Window struct {
*tk.Window
}
func NewWindow() *Window {
mw := &Window{tk.RootWindow()}
lbl := tk.NewLabel(mw, "Hello ATK")
btn := tk.NewButton(mw, "Quit")
btn.OnCommand(func() {
tk.Quit()
})
tk.NewVPackLayout(mw).AddWidgets(lbl, tk.NewLayoutSpacer(mw, 0, true), btn)
mw.ResizeN(300, 200)
return mw
}
func main() {
tk.MainLoop(func() {
mw := NewWindow()
mw.SetTitle("ATK Sample")
mw.Center()
mw.ShowNormal()
})
}