资讯详情

golang GUI for nuxui — HelloWorld

创建 hello 项目

mkdir hello cd hello go mod init example.com/my/hello 

修改 go.mod 文件, 添加 nuxui 依赖库

module example.com/my/hello  go 1.18  require nuxui.org/nuxui v0.0.5  replace nuxui.org/nuxui v0.0.5 => gitee.com/nuxui/nuxui v0.0.5 

更新依赖

go mod tidy 

创建 hello.go 并编写

package main  import (     "nuxui.org/nuxui/nux"     _ "nuxui.org/nuxui/ui" )  func main() { 
            nux.Run(nux.NewWindow(nux.Attr{ 
                "width":  "20%", // screen_width x 20%         "height": "2:1", // width : height = 2 : 1         "title":  "hello",         "content": nux.Attr{ 
                    "type": "nuxui.org/nuxui/ui.Text",             "text": `Hello nuxui`,         },     }))  } 

编译并运行

go build . && ./hello 

结果预览请添加图片描述

标签: nux光电传感器pnnux光电传感器ps

锐单商城拥有海量元器件数据手册IC替代型号,打造 电子元器件IC百科大全!

锐单商城 - 一站式电子元器件采购平台