tech:go_lang_-_gui

Go lang - GUI

Par nature Go n'est pas orienté utilisateur.

L'interface graphique “naturelle” à Go est le Web (WebUI)

Cependant il est possible d'utiliser :

  • Tk9 https://pkg.go.dev/modernc.org/tk9.0 pour des applis simple et portable CGo-free il est vraiment natif Go et crossplatform
  • Qt avec https://github.com/mappu/miqt Qt est la référence
  • Wails projet prometteur, mais pas compatible pour les anciennes versions. nécessite Node (Svelte, React, Vue, Preact, Lit, Vanilla)
  • Flutter : Pour Android

Qt - miqt

package main
 
import (
        "fmt"
        "os"
 
        "github.com/mappu/miqt/qt"
)
 
func main() {
 
        qt.NewQApplication(os.Args)
 
        btn := qt.NewQPushButton3("Hello world!")
        btn.SetFixedWidth(320)
 
        var counter int = 0
 
        btn.OnPressed(func() {
                counter++
                btn.SetText(fmt.Sprintf("You have clicked the button %d time(s)", counter))
        })
 
        btn.Show()
 
        qt.QApplication_Exec()
 
        fmt.Println("OK!")
}

FIXME

tech/go_lang_-_gui.txt · Dernière modification : de Jean-Baptiste

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki