go-sciter
Golang bindings of Sciter: the Embeddable HTML/CSS/script engine for modern UI development
Top Related Projects
Tiny cross-platform webview library for C/C++. Uses WebKit (GTK/Cocoa) and Edge WebView2 (Windows).
Create beautiful applications using Go
Build cross platform GUI apps with GO and HTML/JS/CSS (powered by Electron)
Qt binding for Go (Golang) with support for Windows / macOS / Linux / FreeBSD / Android / iOS / Sailfish OS / Raspberry Pi / AsteroidOS / Ubuntu Touch / JavaScript / WebAssembly
Cross platform GUI toolkit in Go inspired by Material Design
A package to build progressive web apps with Go programming language and WebAssembly.
Quick Overview
Go-sciter is a Go bindings for the Sciter engine, allowing developers to create desktop applications with HTML, CSS, and JavaScript using Go. It provides a bridge between Go and Sciter, enabling the creation of cross-platform GUI applications with web technologies while leveraging Go's performance and features.
Pros
- Cross-platform development for desktop applications
- Combines the power of Go with the flexibility of web technologies
- Lightweight and fast compared to Electron-based solutions
- Rich set of UI controls and styling options
Cons
- Limited community support compared to more mainstream frameworks
- Learning curve for developers unfamiliar with Sciter
- Potential compatibility issues with certain web libraries
- Documentation could be more comprehensive
Code Examples
- Creating a basic window:
package main
import (
"github.com/sciter-sdk/go-sciter"
"github.com/sciter-sdk/go-sciter/window"
)
func main() {
w, _ := window.New(sciter.SW_TITLEBAR|sciter.SW_RESIZEABLE, nil)
w.LoadFile("hello.html")
w.Show()
w.Run()
}
- Handling events:
w.SetCallback(func(w *window.Window, e *sciter.Event) bool {
switch e.Type {
case sciter.EVENT_DOCUMENT_COMPLETE:
println("Document loaded")
}
return false
})
- Calling Go functions from JavaScript:
func init() {
sciter.SetCallback("goFunction", func(args ...*sciter.Value) *sciter.Value {
println("Called from JavaScript")
return sciter.NewValue("Hello from Go!")
})
}
Getting Started
- Install Sciter SDK from the official website.
- Install go-sciter:
go get github.com/sciter-sdk/go-sciter
- Create an HTML file for your UI.
- Write a Go program to create a window and load the HTML file (see the first code example above).
- Build and run your application:
go build ./your_app_name
Competitor Comparisons
Tiny cross-platform webview library for C/C++. Uses WebKit (GTK/Cocoa) and Edge WebView2 (Windows).
Pros of webview
- Simpler API and easier to use for basic web-based GUIs
- Lighter weight and smaller footprint
- Uses system's native web engine, reducing dependencies
Cons of webview
- Less feature-rich compared to Sciter's capabilities
- Limited customization options for UI components
- Potentially less consistent cross-platform appearance
Code Comparison
webview:
package main
import "github.com/webview/webview"
func main() {
w := webview.New(true)
defer w.Destroy()
w.SetTitle("Minimal webview example")
w.SetSize(800, 600, webview.HintNone)
w.Navigate("https://example.com")
w.Run()
}
go-sciter:
package main
import "github.com/sciter-sdk/go-sciter"
import "github.com/sciter-sdk/go-sciter/window"
func main() {
w, _ := window.New(sciter.SW_TITLEBAR|sciter.SW_RESIZEABLE, nil)
w.SetTitle("Minimal Sciter example")
w.LoadFile("example.html")
w.Show()
w.Run()
}
The code examples demonstrate that webview has a more straightforward API for basic use cases, while go-sciter requires more setup but offers greater control over the window and content loading.
Create beautiful applications using Go
Pros of Wails
- Uses standard web technologies (HTML, CSS, JavaScript) for UI development, making it more accessible to web developers
- Supports hot reloading, enabling faster development and iteration
- Offers built-in tooling for building and packaging applications
Cons of Wails
- Larger application size due to bundling of web technologies
- Potentially slower performance compared to native UI frameworks
- Limited to Go programming language for backend logic
Code Comparison
Wails:
package main
import (
"github.com/wailsapp/wails"
)
func main() {
app := wails.CreateApp(&wails.AppConfig{
Width: 1024,
Height: 768,
Title: "My Wails App",
})
app.Run()
}
Go-sciter:
package main
import (
"github.com/sciter-sdk/go-sciter"
"github.com/sciter-sdk/go-sciter/window"
)
func main() {
w, _ := window.New(sciter.SW_TITLEBAR|sciter.SW_RESIZEABLE, nil)
w.LoadFile("index.html")
w.Show()
w.Run()
}
Both frameworks aim to simplify desktop application development using Go, but they differ in their approach. Wails leverages web technologies, making it more familiar to web developers, while Go-sciter uses its own lightweight rendering engine. The choice between the two depends on specific project requirements, team expertise, and performance considerations.
Build cross platform GUI apps with GO and HTML/JS/CSS (powered by Electron)
Pros of go-astilectron
- Built on Electron, allowing for a more feature-rich and modern web-based UI
- Supports multiple platforms (Windows, macOS, Linux) out of the box
- Larger community and ecosystem due to Electron's popularity
Cons of go-astilectron
- Larger application size due to bundling Chromium and Node.js
- Higher memory usage compared to native or lightweight alternatives
- Potentially slower startup times and performance overhead
Code Comparison
go-astilectron:
astilectron.New(astilectron.Options{
AppName: "MyApp",
AppIconDefaultPath: "icon.png",
}).Run()
go-sciter:
w, _ := sciter.CreateWindow(sciter.SW_TITLEBAR|sciter.SW_RESIZEABLE, nil)
w.LoadFile("index.html")
w.Show()
go-astilectron uses Electron's architecture, allowing for more complex web-based UIs, while go-sciter provides a lightweight native UI solution with HTML/CSS rendering. go-astilectron may be preferred for larger applications with rich interfaces, while go-sciter is suitable for smaller, performance-sensitive projects. The choice between them depends on the specific requirements of your application, balancing features, performance, and resource usage.
Qt binding for Go (Golang) with support for Windows / macOS / Linux / FreeBSD / Android / iOS / Sailfish OS / Raspberry Pi / AsteroidOS / Ubuntu Touch / JavaScript / WebAssembly
Pros of Qt
- More comprehensive GUI toolkit with a wider range of widgets and controls
- Cross-platform support for desktop and mobile platforms
- Large and active community with extensive documentation and resources
Cons of Qt
- Larger binary size and resource footprint
- Steeper learning curve due to its extensive feature set
- Licensing considerations for commercial applications
Code Comparison
Qt:
package main
import (
"os"
"github.com/therecipe/qt/widgets"
)
func main() {
app := widgets.NewQApplication(len(os.Args), os.Args)
window := widgets.NewQMainWindow(nil, 0)
window.SetWindowTitle("Hello Qt")
window.Show()
app.Exec()
}
go-sciter:
package main
import (
"github.com/sciter-sdk/go-sciter"
"github.com/sciter-sdk/go-sciter/window"
)
func main() {
w, _ := window.New(sciter.SW_TITLEBAR|sciter.SW_RESIZEABLE, nil)
w.SetTitle("Hello Sciter")
w.Show()
w.Run()
}
Both Qt and go-sciter provide ways to create GUI applications in Go, but Qt offers a more feature-rich toolkit at the cost of increased complexity and resource usage. go-sciter, while lighter and easier to start with, may have limitations for more complex applications. The choice between the two depends on the specific requirements of your project, such as platform support, performance needs, and desired feature set.
Cross platform GUI toolkit in Go inspired by Material Design
Pros of Fyne
- Pure Go implementation, no external dependencies
- Cross-platform support with native look and feel
- Active development and community support
Cons of Fyne
- Larger application size due to bundled resources
- Limited styling options compared to HTML/CSS
Code Comparison
Fyne:
package main
import (
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/widget"
)
func main() {
a := app.New()
w := a.NewWindow("Hello")
w.SetContent(widget.NewLabel("Hello, Fyne!"))
w.ShowAndRun()
}
go-sciter:
package main
import (
"github.com/sciter-sdk/go-sciter"
"github.com/sciter-sdk/go-sciter/window"
)
func main() {
w, _ := window.New(sciter.SW_TITLEBAR|sciter.SW_RESIZEABLE, nil)
w.LoadFile("hello.html")
w.SetTitle("Hello")
w.Show()
w.Run()
}
The code comparison shows that Fyne uses a more Go-centric approach, creating UI elements directly in Go code. go-sciter, on the other hand, relies on HTML files for UI definition, which may be more familiar to web developers but requires additional file management.
Fyne's pure Go implementation makes it easier to distribute and deploy applications, while go-sciter's use of the Sciter engine allows for more complex UI designs using HTML and CSS.
A package to build progressive web apps with Go programming language and WebAssembly.
Pros of go-app
- Cross-platform development: Build web, desktop, and mobile apps from a single codebase
- Progressive Web App (PWA) support: Easily create installable web apps with offline capabilities
- Server-side rendering: Improves initial load times and SEO
Cons of go-app
- Steeper learning curve: Requires understanding Go-specific concepts for UI development
- Limited native UI components: May not provide the same level of native look and feel as Sciter
Code Comparison
go-app:
type hello struct {
app.Compo
}
func (h *hello) Render() app.UI {
return app.H1().Text("Hello World!")
}
go-sciter:
w, err := window.New(sciter.SW_TITLEBAR|sciter.SW_RESIZEABLE|sciter.SW_CONTROLS|sciter.SW_MAIN|sciter.SW_ENABLE_DEBUG, nil)
if err != nil {
log.Fatal(err)
}
w.LoadFile("hello.html")
w.Show()
go-app focuses on a component-based approach using Go structs, while go-sciter relies more on HTML files for UI definition and uses Go primarily for window management and event handling. go-app provides a more integrated Go-centric development experience, while go-sciter offers closer integration with native UI elements through Sciter's rendering engine.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
Go bindings for Sciter
Check this page for other language bindings (Delphi / D / Go / .NET / Python / Rust).
Attention
The ownership of project is transferred to this new organization.
Thus the import path
for golang should now be github.com/sciter-sdk/go-sciter
, but the package name is still sciter
.
Introduction
This package provides a Golang bindings of Sciter using cgo.
Using go sciter you must have the platform specified sciter dynamic library
downloaded from sciter-sdk, the library itself is rather small
(under 5MB, less than 2MB when upxed) .
Most Sciter API are supported, including:
- Html string/file loading
- DOM manipulation/callback/event handling
- DOM state/attribute handling
- Custom resource loading
- Sciter Behavior
- Sciter Options
- Sciter Value support
- NativeFunctor (used in sciter scripting)
And the API are organized in more or less a gopher friendly way.
Things that are not supported:
- Sciter Node API
- TIScript Engine API
Getting Started
At the moment only Go 1.10 or higher is supported (issue #136).
-
Download the sciter-sdk
-
Extract the sciter runtime library from sciter-sdk to system PATH
The runtime libraries lives in
bin
bin.lnx
bin.osx
with suffix likedll
so
ordylib
- Windows: simply copying
bin\64\sciter.dll
toc:\windows\system32
is just enough - Linux:
cd sciter-sdk/bin.lnx/x64
export LIBRARY_PATH=$PWD
echo $PWD >> libsciter.conf
sudo cp libsciter.conf /etc/ld.so.conf.d/
sudo ldconfig
ldconfig -p | grep sciter
should print libsciter-gtk.so location
- OSX:
cd sciter-sdk/bin.osx/
export DYLD_LIBRARY_PATH=$PWD
- Windows: simply copying
-
Set up GCC envrionmnet for CGO
mingw64-gcc (5.2.0 and 7.2.0 are tested) is recommended for Windows users.
Under Linux gcc(4.8 or above) and gtk+-3.0 are needed.
-
go get -x github.com/sciter-sdk/go-sciter
-
Run the example and enjoy :)
Sciter Desktop UI Examples
Sciter Version Support
Currently supports Sciter version 4.0.0.0
and higher.
About Sciter
Sciter is an Embeddable HTML/CSS/script engine for modern UI development, Web designers, and developers, can reuse their experience and expertise in creating modern looking desktop applications.
In my opinion, Sciter , though not open sourced, is an great desktop UI development envrionment using the full stack of web technologies, which is rather small (under 5MB) especially compared to CEF,Node Webkit and Atom Electron. :)
Finally, according to Andrew Fedoniouk the author and the Sciter
END USER LICENSE AGREEMENT
, the binary form of the Sciter
dynamic libraries are totally free to use for commercial or
non-commercial applications.
The Tailored Sciter C Headers
This binding ueses a tailored version of the sciter C Headers, which lives in directory: include
. The included c headers are a modified version of the
sciter-sdk standard headers.
It seems Sciter is developed using C++, and the included headers in the Sciter SDK are a mixture of C and C++, which is not quite suitable for an easy golang binding.
I'm not much fond of C++ since I started to use Golang, so I made this modification and hope Andrew Fedoniouk the author would provide pure C header files for Sciter. :)
Top Related Projects
Tiny cross-platform webview library for C/C++. Uses WebKit (GTK/Cocoa) and Edge WebView2 (Windows).
Create beautiful applications using Go
Build cross platform GUI apps with GO and HTML/JS/CSS (powered by Electron)
Qt binding for Go (Golang) with support for Windows / macOS / Linux / FreeBSD / Android / iOS / Sailfish OS / Raspberry Pi / AsteroidOS / Ubuntu Touch / JavaScript / WebAssembly
Cross platform GUI toolkit in Go inspired by Material Design
A package to build progressive web apps with Go programming language and WebAssembly.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot