GTK+3 的 Go 绑定 gotk3

码农软件 · 软件分类 · GUI开发框架 · 2019-08-07 23:14:50

软件介绍

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的垃圾收集器无缝工作,而无需使用或理解图形对象的浮动参考。

简单示例:

package main
import (
    "github.com/conformal/gotk3/gtk"
    "log"
)
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
    // "destroy" signal to exit the GTK main loop when it is destroyed.
    win, err := gtk.WindowNew(gtk.WINDOW_TOPLEVEL)
    if err != nil {
        log.Fatal("Unable to create window:", err)
    }
    win.SetTitle("Simple Example")
    win.Connect("destroy", func() {
        gtk.MainQuit()
    })
    // Create a new label widget to show in the window.
    l, err := gtk.LabelNew("Hello, gotk3!")
    if err != nil {
        log.Fatal("Unable to create label:", 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()
}

本文地址:https://codercto.com/soft/d/11881.html

HTML5秘籍(第2版)

HTML5秘籍(第2版)

[美] Matthew MacDonald / 李松峰、朱巍、刘帅 / 人民邮电出版社 / 2015-4 / 89.00元

不依赖插件添加音频和视频,构建适用于所有浏览器的播放页面。 用Canvas创建吸引人的视觉效果,绘制图形、图像、文本,播放动画,运行交互游戏。 用CSS3将页面变活泼,比如添加新奇的字体,利用变换和动画添加吸引人的效果。 设计更出色的Web表单,利用HTML5新增的表单元素更加高效地收集访客信息。 一次开发,多平台运行,实现响应式设计,创建适配桌面计算机、平板电脑和智能手机......一起来看看 《HTML5秘籍(第2版)》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具