This is a creation in
Article, where the information may have evolved or changed.
1, about GUI
Golang also really has a GUI framework for development. It seems easier on Mac. Just use it directly.
I don't know how it is on other platforms.
GitHub Project Address:
https://github.com/andlabs/ui/wiki/Getting-Started
The lifting core is still used: Https://github.com/andlabs/libui
There are still quite a few stars on GitHub. Very active project.
Doc Documentation:
Https://godoc.org/github.com/andlabs/ui
There's nothing else to think about. The feeling of wxwidgets should also be cross-platform.
Https://github.com/dontpanic92/wxGo also has a buddy to do the encapsulation.
But it's less to see the stars. Let's use the Andlabs/ui.
2,andlabs GUI's Hello World
Installation:
Go get Github.com/andlabs/ui
Package Mainimport ("Github.com/andlabs/ui" "FMT") Func main () {err: = UI. Main(func () {Name: = UI. NewEntry() button: = UI. Newbutton("Test") Greeting: = UI. Newlabel("") Box: = UI. Newverticalbox() box. Append(UI. Newlabel("Enter Name:"), false) box. Append(name, false) box. Append(Button, false) box. Append(greeting, false)//Create window Windows. and set the length width. window: = UI. NewWindow("First application. ", -, -, false)//mac does not support centering. Https://github. com/andlabs/ui/issues/162Window. SetChild(box) button. OnClicked(Func (*ui. Button) {//can print the log directly. Fmt. Println("Get Name:", name. Text()) Greeting. SetText("Hello,"+ Name. Text() +"!")}) window. OnClosing(Func (*ui. Window) BOOL {UI. Quit() return true}) window. Show()}) if Err! = Nil {panic (err)}}
Feel the Andlabs UI is relatively simple, can only do some of the most basic things.
It's a simple thing, but if it's complicated, it's not going to work.
Look under the source code is not much. A library of encapsulated Libui is used. Support for Windows Mac Linux systems.
Because it is written in C and the feeling of go is still very close together.
3,wxgo
Install Wxgo.
In the country to install Https://github.com/dontpanic92/wxGo project or Andlabs fast.
Often error, timeout. The main reason is that the library is too big to have a MB.
and the library supports Windows Linux Mac So Lib is available in three libraries.
The best way to do this is to download the zip file directly and then unzip it to the $GOPATH/src/github.com/dontpanic92/wxgo directory and install it.
install github.com/dontpanic92/wxGo/wx
Will error some warning information. But you can install the past.
Then you can run the test and the demo.
Package Mainimport"GITHUB.COM/DONTPANIC92/WXGO/WX"Func Main () {WX. Newapp() F: = WX. NewDialog(WX. Nullwindow, -1,"Hello World") Bsizer: = WX. Newboxsizer(WX. VERTICAL) CheckBox: = WX. Newcheckbox(F, WX. ID_any,"Check me!"Wx. DefaultpositionWx. DefaultSize,0) Bsizer. ADD(CheckBox,0Wx. All|wx. EXPAND,5) Textctrl: = WX. Newtextctrl(F, WX. ID_any,""Wx. DefaultpositionWx. DefaultSize,0) Bsizer. ADD(Textctrl,0Wx. All|wx. EXPAND,5) F. Setsizer(Bsizer) F. Layout() F. ShowModal() F. Destroy()}
The code contains good results for sample. Aui.
A super-complicated interface. It is the style of wxwidgets.
The idea is to use http://www.swig.org/
The idea of Swig J is encapsulated. The author also explains this.
The project is also a huge process. The Lib libraries of the 3 platforms were compiled.
4, summary
The text of this text connection is: http://blog.csdn.net/freewebsys/article/details/60141345 not allowed to reprint without the Bo master.
Bo main address is: Http://blog.csdn.net/freewebsys
To do a simple test tool AH. Do a service Check tool Ah, interface test tools AH. The
simple can use the Andlibs UI because of the simple point. LIB Library small installation, easy to develop.
If you develop a complex project, you can use the Wxgo class library to enrich it.
want to develop all can.