wxWidgets和Golang

huangapple go评论98阅读模式
英文:

wxWidgets and Golang

问题

我想用Go语言开发一个具有多操作系统图形用户界面的程序,使用的GUI库是wxWidgets,我的开发环境是WinXP x86。

我想使用wxWidgets的Go语言封装库wxGo,但是文档非常简洁,而且该项目似乎已经停滞了两年。

我在执行go get github.com/JeroenD/wxGogo install github.com/JeroenD/wxGo时遇到了一些错误。

执行go get github.com/JeroenD/wxGo的结果是:

package github.com/JeroenD/wxGo
    imports github.com/JeroenD/wxGo
    imports github.com/JeroenD/wxGo: C:\Documents and Settings\dell\Mes documents\gopath\src\github.com\JeroenD\wxGo中没有Go源文件

执行go install github.com/JeroenD/wxGo的结果是:

无法加载包:package github.com/JeroenD/wxGo: C:\Documents and Settings\dell\Mes documents\gopath\src\github.com\JeroenD\wxGo中没有Go源文件

我尝试按照JeroenD的github上的Building.txt文档进行操作。第一次,我下载并安装了wxWidgets,示例代码能够编译通过(使用MinGW),但是我无法从源代码编译wxWidgets库。第二次,我下载并安装了wxPack,其中包含已经编译好的库文件和动态链接库。在这里,问题是我无法编译wxWidgets的示例代码。

根据JeroenD的github上的Building.txt文档,我安装了SWIGWIN,但是没有从源代码编译它,因为SWIG现在已经支持Go语言(来自SWIG的文档)。但是现在,我不知道该如何处理封装库(wxGo)、wxWidgets的动态链接库和库文件以及SWIG。我记得我读到过SWIG需要*.i文件来实现从一种语言到另一种语言的绑定,但是在我的wxWidgets文件夹中找不到这些文件,也许我需要从其他wxWidgets的绑定库(如wxLua和wxPython)中获取这些文件。

我的目标只是让wxWidgets库能够在Go语言中工作,以便能够编写一个多操作系统的图形用户界面,我有点惊讶没有人在JeroenD的封装库上遇到问题,也没有人想要让wxWidgets在Go语言中工作。

正如你可能会问的那样,使用go-gtk构建一个gtk GUI并不是一个解决方案,因为在我的项目中需要一个多操作系统的GUI,而且它看起来要像操作系统的本地界面(如果你有一个看起来本地化并且更简单易用的多操作系统GUI库,请告诉我)。

英文:

I want to develop a programm in Go with a multi-OS GUI in wxWidgets, my dev environment is WinXP x86.

I wanted to use the wxWidgets Go wrapper wxGo, but the documentation is very succint and the project seems dead since 2 years.

I encountered some errors with the go get github.com/JeroenD/wxGo and go install github.com/JeroenD/wxGo

Result of go get github.com/JeroenD/wxGo:

package github.com/JeroenD/wxGo
    imports github.com/JeroenD/wxGo
    imports github.com/JeroenD/wxGo: no Go source files in C:\Documents and Settings\dell\Mes documents\gopath\src\github.com\JeroenD\wxGo

Result of go install github.com/JeroenD/wxGo:

can't load package: package github.com/JeroenD/wxGo: no Go source files in C:\Documents and Settings\dell\Mes documents\gopath\src\github.com\JeroenD\wxGo

I tried to follow the Building.txt doc from JeroenD's github. First time, I downloaded and installed wxWidgets, the sample codes were able to compile (with MinGW), but I was not able to compile the wxWidgets library from source. The second time, I downloaded and installed wxPack, with libs/dll already compiled. Here, the problem is I can't compile the wxWidgets samples.

As stated in the Buiding.txt doc from JeroenD's github, I installed SWIGWIN, but did not compile it from source as SWIG now supports Go (from SWIG's documentation). But now, I don't know what to do with a wrapper (wxGo), wxWidgets dll/libs, and SWIG. I think I read that SWIG needs *.i files to make bindings from language to another, but I can't find any in my wxWidgets folder, perhaps I have to take these files from another wxWidgets binding (wxLua and wxPython have these in their repos).

My goal is just to get the wxWidgets lib working with Go to be able to write a multi OS GUI in wxWidgets, I'm a bit surprised that nobody had posted problems with JeroenD's package nor wanted to get wxWidgets working with Go.

As you may ask, building a gtk GUI with go-gtk is not a solution, as it is needed in my project to have a multi-OS GUI looking OS native (if you have a multi-OS GUI lib which looks native and is simpler to use, please tell me).

1: https://github.com/JeroenD/wxGo "wxGo"
2: https://github.com/rjpcomputing/wxpack/wiki "wxPack"

答案1

得分: 3

根据Building.txt文件:

要构建wxGo库:
cd wx
make install

所以,尽管这是一个Go包,但它似乎没有使用任何实际的Go代码(如果你在github.com/JeroenD/wxGo中查看,你不会看到任何.go文件)。

我认为,在这种情况下,你需要使用git(而不是go get)和make install(而不是go install)。

在Windows上,你可能想要获取Git for Windows安装程序,以使这个过程变得更简单。

一旦构建完成,你可以像往常一样在你的Go代码中使用

import "wx"

(在https://github.com/JeroenD/wxGo/blob/master/example/minimal/minimal.go中有一个最简示例)

英文:

According to the Building.txt file:

To build the wxGo library:
cd wx
make install

So, despite this being a Go package, it doesn't seem to use any actual Go code (if you look in github.com/JeroenD/wxGo you won't see any .go files).

I think, in cases like this, you need to use git (instead of go get) and make install instead of go install.

On windows you may want to get the Git for Windows installer to make this process a bit simpler.

Once it's built it looks like you can use

import "wx"

as usual in your go code (minimal example at https://github.com/JeroenD/wxGo/blob/master/example/minimal/minimal.go)

答案2

得分: 2

wxGO是用于GO的wxWidgets包装器,可以在这里找到wxGO MultiOS

英文:

wxGO wxWidgets wrapper for GO is live here wxGO MultiOS

答案3

得分: -4

QML可能是一个更好的选择,它有助于处理wxWidget或QT底层。

英文:

QML may be a better choice, it helps deal with wxWidget or QT underwear.

huangapple
  • 本文由 发表于 2013年7月16日 00:35:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/17659233.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定