From KitwarePublic
Jump to: navigation, search

What is KWWidgets ?

KWWidgets is a GUI toolkit. It is:

  • Cross-platform
  • Open-license
  • Free

KWWidgets an be compiled on a large number of platforms, including Windows, Mac, and many flavors of Unix/Linux systems. It is open-source and uses the same BSD-style open-license as VTK. It is available for free and can be downloaded without restrictions.

Visualization Widgets

Like many other GUI toolkits, it provides low-level core widgets like buttons, entries, scales, menus, combo-boxes, thumbwheels, spin-boxes, trees, notebooks and multi-column lists to name a few. Unlike many of those toolkits though, it also provides advanced composite widgets like toolbars, tooltips, progress gauges, split-frames, splash-screens, 2D/3D extents, color pickers, histograms, windows and dialogs.

More importantly, KWWidgets builds upon this set of widgets to interface to visualization libraries like VTK and offer high-level visualization-oriented widgets like surface material editors, simple animation generators, transfer function editors, annotation editors, window/level and volume property preset editors, text property editors, 2D and 3D rendering widgets, etc. This is actually the very same code-base that we use and expand daily to create open-source and commercial applications at Kitware.

color transfer function editor


As its core, KWWidgets is an object-oriented C++ layer on top of the Tcl/Tk UI toolkit. It uses the same coding framework and guidelines as VTK. It can interact and co-exist with Tcl/Tk directly from C++, allowing you to load or execute Tcl modules directly from a C++ application. Just as VTK, KWWidgets is wrapped automatically into a Tcl package and/or a Python module at compile-time, and can therefore be used directly from Tcl/Tk or Python, allowing you to fast-prototype applications, create small KWWidgets scripts that can be used from a Tcl/Tk or Python application, write testing or demo scripts. Tcl and Python scripts are interpreted directly, without the need to compile or link any single line of code.

The following code snippets demonstrate how to create a checkbutton inside a toplevel window, and compares both the Tcl, Python and C++ approaches. A few details have been left out, but you can get a feeling of the syntaxes and notice how close they are. Check the examples section for fully-functional examples.

A checkbutton
vtkKWApplication *app = vtkKWApplication::New(); Create an application object

vtkKWTopLevel *top = vtkKWTopLevel::New();

Create a toplevel window

vtkKWCheckButton *cb = vtkKWCheckButton::New();

Create a checkbutton, parent it to the toplevel
cb->SetText("A checkbutton"); Set the checkbutton label
cb->Deselect(); Deselect the checkbutton

package require kwwidgets Load the KWWidgets package in Tcl
set app [vtkKWApplication New] Create an application object

set top [vtkKWTopLevel New]
$top SetApplication $app
$top Create

Create a toplevel window

set cb [vtkKWCheckButton New]
$cb SetParent $top
$cb Create

Create a checkbutton, parent it to the toplevel
$cb SetText "A checkbutton" Set the checkbutton label
$cb Deselect Deselect the checkbutton

from kwwidgets import * Load the KWWidgets module in Python
app = vtkKWApplication() Create an application object

top = vtkKWTopLevel()

Create a toplevel window

cb = vtkKWCheckButton()

Create a checkbutton, parent it to the toplevel
cb.SetText("A checkbutton") Set the checkbutton label
cb.Deselect() Deselect the checkbutton


KWWidgets uses CTest (part of CMake) to evaluate the source tree automatically. The KWWidgets dashboard reports how successfully KWWidgets compiled and tested on many different platforms and compilers every day. If it is mainly "green", the project is in good shape. A lot of "red" warn people they should make sure their changes did not break anything; the dashboard can be browsed back in time to find out what introduced the problem.

KWWidgets dashboard

In the future, a tracing framework will be added so that KWWidgets application can be tested by recording user-interactions and reproducing them automatically.

KWWidgets: [Welcome | Site Map]