KWWidgets/Overview
From KitwarePublic
Contents |
[edit] 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.
[edit] 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.
| vs. |
[edit] Object-Oriented
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.
| C++ | ||
|---|---|---|
| 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 |
| Tcl | ||
|---|---|---|
| package require kwwidgets | Load the KWWidgets package in Tcl | |
| set app [vtkKWApplication New] | Create an application object | |
|
set top [vtkKWTopLevel New] | Create a toplevel window | |
|
set cb [vtkKWCheckButton New] | Create a checkbutton, parent it to the toplevel | |
| $cb SetText "A checkbutton" | Set the checkbutton label | |
| $cb Deselect | Deselect the checkbutton |
| Python | ||
|---|---|---|
| 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 |
[edit] Tested
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.
In the future, a tracing framework will be added so that KWWidgets application can be tested by recording user-interactions and reproducing them automatically.
| |



