gotk3 GTK+3 的 Go 绑定 gotk3

xuanbao • 3294 次点击    
这是一个分享于 的项目,其中的信息可能已经有所发展或是发生改变。
gotk3 提供 Go 绑定 GTK+3 和依赖的其他项目。每个组件都给出了用来导入包路径的子目录。以下是部分已经实施的支持库: * GTK+3 (3.6 and later) * GDK 3 (3.6 and later) * GLib 2 (2.36 and later) * Cairo (1.10 and later) 已经采取谨慎的内存管理与Go的垃圾收集器无缝工作,而无需使用或理解图形对象的浮动参考。 简单示例: <pre class="brush:cpp ;toolbar: true; auto-links: false;">package main import (     &#34;github.com/conformal/gotk3/gtk&#34;     &#34;log&#34; ) func main() {     // Initialize GTK without parsing any command line arguments.     gtk.Init(nil)     // Create a new toplevel window, set its title, and connect it to the     // &#34;destroy&#34; signal to exit the GTK main loop when it is destroyed.     win, err := gtk.WindowNew(gtk.WINDOW_TOPLEVEL)     if err != nil {         log.Fatal(&#34;Unable to create window:&#34;, err)     }     win.SetTitle(&#34;Simple Example&#34;)     win.Connect(&#34;destroy&#34;, func() {         gtk.MainQuit()     })     // Create a new label widget to show in the window.     l, err := gtk.LabelNew(&#34;Hello, gotk3!&#34;)     if err != nil {         log.Fatal(&#34;Unable to create label:&#34;, err)     }     // Add the label to the window.     win.Add(l)     // Set the default window size.     win.SetDefaultSize(800, 600)     // Recursively show all widgets contained in this window.     win.ShowAll()     // Begin executing the GTK main loop.  This blocks until     // gtk.MainQuit() is run.      gtk.Main() }</pre>
授权协议:
其他
开发语言:
Google Go 查看源码»
操作系统:
跨平台
3294 次点击  
加入收藏 微博
暂无回复
添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传