mudream4869 / toolgui

ToolGUI: Build tool apps in Go
https://toolgui-doc.fly.dev/
MIT License
2 stars 0 forks source link
developer-tools go golang internal-tools

ToolGUI

Go Reference

This Go package provides a framework for rapidly building interactive data dashboards and web applications. It aims to offer a similar development experience to Streamlit for Python users.

[!WARNING] ⚠️ Under Development:

The API for this package is still under development, and may be subject to changes in the future.

Hello world

package main

import (
    "log"
    "github.com/mudream4869/toolgui/toolgui/tgcomp"
    "github.com/mudream4869/toolgui/toolgui/tgexec"
    "github.com/mudream4869/toolgui/toolgui/tgframe"
)

func Main(p *tgframe.Params) error {
    name := tgcomp.Textbox(p.State, p.Sidebar, "What's your name?")
    if name != "" {
        tgcomp.Text(p.Sidebar, "Hi "+name+"~")
    }

    tgcomp.Text(p.Main, "hello ")
    if tgcomp.Button(p.State, p.Main, "keep going") {
        tgcomp.Text(p.Main, "world")
    }
    return nil
}

func main() {
    app := tgframe.NewApp()
    app.AddPage("index", "Index", Main)
    e := tgexec.NewWebExecutor(app)
    log.Println("Starting service...")
    e.StartService(":3000")
}

For Dev

Dependency

Run demo

task run_demo

Run E2E Test

task run_demo
cd toolgui-e2e
cypress e2e:chrome
cypress e2e:firefox