Getting Started
Using the Fyne toolkit to build cross platform applications is very simple but does require some tools to be installed before you can begin. If your computer is set up for development with Go then the following steps may not be required, but we advise reading the tips for your operating system just in case. If later steps in this tutorial fail then you should re-visit the prerequisites below.
Prerequisites
Fyne requires 3 basic elements to be present, the Go tools (at least version 1.19), a C compiler (to connect with system graphics drivers) and a system graphics driver. The instructions vary depending on your operating system, choose the appropriate tab below for installation instructions.
Note that these steps are just required for development - your Fyne applications will not require any setup or dependency installation for end users!
Supported Platforms see: wiki/Supported-Platforms
Windows macOS X Linux BSD Android iOSYou will need to install Go, GCC and the graphics library header files using your package manager. Choose the command corresponding to your distribution:
Debian, Ubuntu and Raspberry Pi OS: sudo apt-get install golang gcc libgl1-mesa-dev xorg-dev libxkbcommon-dev Fedora: sudo dnf install golang golang-misc gcc libXcursor-devel libXrandr-devel mesa-libGL-devel libXi-devel libXinerama-devel libXxf86vm-devel libxkbcommon-devel wayland-devel Arch Linux: sudo pacman -S go xorg-server-devel libxcursor libxrandr libxinerama libxi libxkbcommon Solus: sudo eopkg it -c system.devel golang mesalib-devel libxrandr-devel libxcursor-devel libxi-devel libxinerama-devel libxkbcommon-devel openSUSE: sudo zypper install go gcc libXcursor-devel libXrandr-devel Mesa-libGL-devel libXi-devel libXinerama-devel libXxf86vm-devel libxkbcommon-devel Void Linux: sudo xbps-install -S go base-devel xorg-server-devel libXrandr-devel libXcursor-devel libXinerama-devel libXxf86vm-devel libxkbcommon-devel wayland-devel Alpine Linux sudo apk add go gcc libxcursor-dev libxrandr-dev libxinerama-dev libxi-dev linux-headers mesa-dev libxkbcommon-dev wayland-dev NixOS nix-shell -p libGL pkg-config xorg.libX11.dev xorg.libXcursor xorg.libXi xorg.libXinerama xorg.libXrandr xorg.libXxf86vm libxkbcommon waylandDownloading
Since Go 1.16 you will need to set up the module before you can use the package.
Run the following command and replace MODULE_NAME with your preferred module name (this should be called in a new folder specific for your application).
$ mkdir myapp $ cd myapp $ go mod init MODULE_NAME
You now need to download the Fyne module and helper tool. This will be done using the following commands:
$ go get fyne.io/fyne/v2@latest $ go install fyne.io/tools/cmd/fyne@latest
If you are unsure of how Go modules work, consider reading Tutorial: Create a Go module.
Check your installation
Before coding an app or running an example you can check your install using the Fyne Setup tool. Simply download the right app for your computer from the link and run it, you should see something like the following screen:
If there are any problems with your installation see the troubleshooting section for hints.
Run the demo
If you want to see the Fyne toolkit in action before you start to code your own application, you can see our demo app running on your computer by executing:
$ go run fyne.io/demo@latest
Please note that the first run has to compile some C-code and can thus take longer than usual. Subsequent builds reuse the cache and will be much faster.
Installing
If you want to, you can also install the demo using the following command (requires Go 1.16 or later):
$ go install fyne.io/demo@latest
If your GOBIN environment has been added to path (should be by default on macOS and Windows), you can then run the demo:
$ demo
And that’s all there is to it! Now you can write your own Fyne application in your IDE of choice. If you want to see some Fyne code in action then you can read your first application.
网址:Getting Started https://mxgxt.com/news/view/1679337
相关内容
Titanic: Getting Started With RGetting Started with Oracle GraalVM
戳爷 全新歌曲「Got Me Started」官方MV首播,泰国男星 友情出演
访谈录:哈里王子与明星们的慈善事业
OneRepublic主唱谈音乐创作历程
Learn Scala
【数据可视化工具】 ...
Shopify Theme Kit
访谈录:塞缪尔·杰克逊专访
R Tools for Visual Studio