Options for the Tk option database
In
Effective Tcl makes good reading
Effective Tcl/Tk Programming is good reading for any Tk user, including those who rely on PerlTk and Tkinter. Last month we recommended John Grayson's book on Tkinter to anyone scripting graphical user interfaces, whatever the toolkit. Although Grayson's examples are exclusively in Python, his design principles transcend any particular language. Similarly, Harrison and McLennan communicate coding ideas that you'll find useful no matter what language you're using. For example, their presentation of Tk correctly emphasizes the power and flexibility of the built-in canvas and text widgets.
Effective Tcl/Tk Programming also gives a clear exposition on the use of a script as a configuration file to be evaluated. Sections 4.7.8, "Saving a Drawing," and 7.6.6.3, "Using Tcl Commands to Express Data," explore the notion that "Tcl commands are a powerful way of expressing data." Our last column gave several other examples showing that this holds true for commands in any scripting language.
Another strength of Harrison and McLennan's book is its presentation in chapter 7 of the event-based programming style that we've covered in past Regular Expressions columns.
Back to (optional) work
Recall from the first two installments of this series that Tk uses the option command for all actions taken against the option database. We've already looked at the option add and option readfile subcommands. In this column, we'll explain option clear and option get.
option clear resets all assignments made to the option database by previous option add or option readfile commands. The idea is to return to a fresh wish process, one initialized only with the platform-specific resource database values. Tk implements this by dropping all values, and, at the time of the next use of the resource database, re-reading the external ~/.Xdefaults. This can surprise newcomers. An example helps: if .Xdefaults in your home directory contains the line:
*Button.background: cyan
and you run the script:
Symantec Backup Exec 12 and Backup Exec System Recovery 8 deliver industry leading Windows data protection and system recovery. Download this whitepaper to find out the top reasons to upgrade and how to get continuous data protection and complete system recovery.
Data and system loss — from a hard drive failure, malicious attack, natural disaster, or simple human error — can happen anytime. Don’t leave your business vulnerable. Make sure you have a secure recovery strategy in place. Symantec's latest backup and system recovery technology can efficiently restore critical applications, individual emails and documents and even restore your entire system in minutes in the event of a loss.
Businesses face a growing challenge to ensure that the IT environment is properly protected. Backup Exec 12 integrates with other applications in the Symantec family of products, to complement your current data protection strategy, keep your data securely backed up and make it recoverable when you need it most.







