File List
Not logged in

The union of all files from all check-ins in directory undroid/twv   [history]


twv aka Tcl webview (WIP)

Tcl extension that provides API for the webview library. Modeled after the Python binding.

Build instructions

Building on Linux and MacOSX:

make TCL_CFLAGS="-I... -DUSE_TCL_STUBS" TCL_LDFLAGS="-L... -ltclstub8.6"

Building for Windows using MingW cross compiler:

make TCL_CFLAGS="-I... -DUSE_TCL_STUBS" TCL_LDFLAGS="-L... -ltclstub86" TARGET_OS=Windows_NT

Getting started

Try the following example:

package require twv
set W [twv::new -width 800 -heigh 600 -title Hello -resizable 1 -debug 0 -url "https://www.androwish.org"]
$W run

You may use most of the webview APIs:

# Change window title
$W title "New title"
# Make window fullscreen
$W fullscreen 1
# Change initial window background color
$W color 255 0 0 0
# Evaluate JS
$W eval "alert('hello')"
# Call JS function
$W call alert "Hello World"
# Inject some CSS (needs testing)
$W inject_css "* {background-color: yellow; }"
# Show native OS dialog
set path [$W dialog open "Open File"]
# Post function to the UI thread (needs testing)
$W dispatch {puts "Hello world!"}
# Control run loop, blocking version
while {[$W loop 1]} {
  # do something
}
# Run loop, returns when webview terminated
$W run