go语言的一个gui 开源 项目 https://github.com/andlabs/ui

rojas · 2015-03-19 03:00:01 · 6871 次点击 · 预计阅读时间 1 分钟 · 大约8小时之前 开始浏览    
这是一个创建于 2015-03-19 03:00:01 的文章,其中的信息可能已经有所发展或是发生改变。

           go语言的一个gui 开源 项目  https://github.com/andlabs/ui

 

1 安装  mingw-w64  链接地址:

http://mingw-w64.sourceforge.net/download.php

 

2 liteide 配置:

# native compiler windows 386

GOROOT=c:\go
GOBIN=%GOROOT%\bin
GOARCH=386
GOOS=windows
CGO_ENABLED=1

PATH=C:\Program Files\mingw-w64\i686-4.9.2-win32-dwarf-rt_v3-rev1\mingw32\bin;%GOROOT%\bin;%PATH%
#GOPATH=c:\go

LITEIDE_GDB=gdb
LITEIDE_MAKE=make
LITEIDE_TERM=%COMSPEC%
LITEIDE_TERMARGS=
LITEIDE_EXEC=%COMSPEC%
LITEIDE_EXECOPT=/C

3 考入例子源码:
package main

import (
    "github.com/andlabs/ui"
)

var window ui.Window

func main() {
    go ui.Do(func() {
        name := ui.NewTextField()
        button := ui.NewButton("Greet")
        greeting := ui.NewLabel("")
        stack := ui.NewVerticalStack(
            ui.NewLabel("Enter your name:"),
            name,
            button,
            greeting)
        window = ui.NewWindow("Hello", 200, 100, stack)
        button.OnClicked(func() {
            greeting.SetText("Hello, " + name.Text() + "!")
        })
        window.OnClosing(func() bool {
            ui.Stop()
            return true
        })
        window.Show()
    })
    err := ui.Go()
    if err != nil {
        panic(err)
    }
}

4 效果截图:








有疑问加站长微信联系(非本文作者)

本文来自:博客园

感谢作者:rojas

查看原文:go语言的一个gui 开源 项目 https://github.com/andlabs/ui

入群交流(和以上内容无关):加入Go大咖交流群,或添加微信:liuxiaoyan-s 备注:入群;或加QQ群:692541889

6871 次点击  
加入收藏 微博
2 回复  |  直到 2000-01-01 00:00:00
virnos
virnos · #1 · 9年之前

C:/go/bin/go.exe get -v . [D:/go/src/ui] github.com/andlabs/ui

github.com/andlabs/ui

..\github.com\andlabs\ui\area.go:9:17: fatal error: ui.h: No such file or directory // #include "ui.h" ^ compilation terminated. 错误: 进程退出代码 2.

我删除掉这行(// #include "ui.h")后, 提示:

C:/go/bin/go.exe get -v . [D:/go/src/ui] github.com/andlabs/ui

github.com/andlabs/ui

could not determine kind of name for C.intmax_t could not determine kind of name for C.uiArea could not determine kind of name for C.uiAreaHandler could not determine kind of name for C.uiAreaQueueRedrawAll could not determine kind of name for C.uiAreaSetSize could not determine kind of name for C.uiControl could not determine kind of name for C.uiControlDestroy could not determine kind of name for C.uiControlDisable could not determine kind of name for C.uiControlEnable could not determine kind of name for C.uiControlHandle could not determine kind of name for C.uiControlHide could not determine kind of name for C.uiControlShow could not determine kind of name for C.uiNewArea could not determine kind of name for C.uiNewScrollingArea 错误: 进程退出代码 2.

我liteide 配置如下;

native compiler windows 386

#GOROOT=c:\go

#GOBIN=

#GOARCH=386

#GOOS=windows

#CGO_ENABLED=1

#GO15VENDOREXPERIMENT=1

#PATH=%PATH%;C:\mingw-w64\x86_64-5.3.0-posix-seh-rt_v4-rev0\mingw64\bin;

#LITEIDE_GDB=gdb LITEIDE_MAKE=mingw32-make LITEIDE_TERM=%COMSPEC% LITEIDE_TERMARGS= LITEIDE_EXEC=%COMSPEC% LITEIDE_EXECOPT=/C

求指导。

virnos
virnos · #2 · 9年之前

上面的处理好了, 我把注释去掉就可以了, 但报了这个错, C:/go/bin/go.exe get -v . [D:/go/src/ui] github.com/andlabs/ui

github.com/andlabs/ui

C:/mingw-w64/x86_64-5.3.0-posix-seh-rt_v4-rev0/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lui collect2.exe: error: ld returned 1 exit status 错误: 进程退出代码 2.

求指导。

添加一条新回复 (您需要 登录 后才能回复 没有账号 ?)
  • 请尽量让自己的回复能够对别人有帮助
  • 支持 Markdown 格式, **粗体**、~~删除线~~、`单行代码`
  • 支持 @ 本站用户;支持表情(输入 : 提示),见 Emoji cheat sheet
  • 图片支持拖拽、截图粘贴等方式上传