In addition to Mac-specific Tk widgets, Code by Kevin has also implemented some Tk widgets that add broad functionality to a Tk application, and which should run on any platform supported by Tcl/Tk. These packages are available on an open-source basis, below. See the packages for licensing terms.
TkWebView is a Tk widget based on the htmllib package and browser client developed by Stephen Uhler and maintained by Clif Flynt. It is intended to provide a lightweight HTML viewer for applications, either as a standalone window or as an embedded widget.
The source code for the original htmllib package is included in the htmllib-rel_0_3_4.zip file.
The same BSD-style license that applies to the older version of the package applies to the current modifications; see license.terms. The modifications are summarized in the documentation and are annotated in the source code with comments.
Under the hood, TkWebView is very complex, but it can be implemented very simply in an application. There are three main processes one can use:
proc WebView_Standalonewidget {title file} for a standalone toplevel HTML viewer, where title is the window title and file is the HTML file to be displayed.
proc WebView_Helpviewer {file} for a specialized standalone viewer for user help, where file is the HTML to be displayed.
proc WebView_Embeddedwidget {w file} where w is the parent widget and file is the HTML file to be displayed.
See the demo source code in webview.tcl for more detailed examples on how to implement this widget in your application.
The simpleDND package implements a lightweight mechanism for drag-and-drop operations within a single Tcl/Tk application. When used, it provides a visual icon and cursor change to indicate a dragged object, and can execute any Tcl command upon a successful drop operation. The package is designed to be easy-to-use, with just a few commands required to add drag-and-drop. Any widget can be registered as a drag source or drop target.
simpleDND is called via package require simpleDND. It is implemented with the following command:
proc dragRegister {w target dragcmd dropcmd}: w is the source widget where the drag is initiated, target is the target widget where the drop is completed, dragcmd is the Tcl command that is executed on the start of the drag operation, and dropcmd is the Tcl command that is executed when the drop operation is completed.
simplednd::dragRegister must be called for each widget that is set up as a drag source. For instance, if you have a listbox .l and a listbox .b that are both drag sources, the command must be called for each widget. Also, if listbox .l and listbox .b have multiple drop targets, then the command must be called for each drop target.
The dragcmd should be used to configure the drag icon. The variables ::simplednd::dragtext and ::simplednd::dragimg are used for this purpose. At a minimum, you must define a single command setting default values for the dragtext and dragimg variables, or you can provide a different command for each drag operation. simpleDND does not provide default values for the text or image in the drag icon; without at least one dragcmd, you will be dragging around an empty label as the drag icon.
The dropcmd is called on a successful drop, i.e. when the button is released over the drop target registered with the drag source. If the button is released over a widget that is not registered as the drop target, the cursor changes to a standard arrow and the drag icon disappears.
Text ©2012 WordTech Communications, LLC. See Credits for other acknowledgments.

Home/Products
Blog
Open Source
Contact
Newsletter
Sales Policies
Credits
About