Tcl and the Tk Toolkit - John K. Ousterhout

Tcl and the Tk Toolkit

Buch | Softcover
480 Seiten
1994
Addison Wesley (Verlag)
978-0-201-63337-5 (ISBN)
51,25 inkl. MwSt
zur Neuauflage
  • Titel ist leider vergriffen;
    keine Neuauflage
  • Artikel merken
Zu diesem Artikel existiert eine Nachauflage
The Tcl scripting language and the Tk toolkit together represent one of the most exciting innovations in X Window System programming. This book offers an introduction and overview of Tcl and Tk and then presents detailed instructions for script writing in Tcl and working with the Tk toolkit.
Since Tcl and the Tk Toolkit is written by the creator of the Tcl scripting language and the Tk toolkit, this book is the single authoritative resource for anyone who wants to produce far more powerful X Window System applications in a fraction of the time that would otherwise be required. Tcl and the Tk Toolkit offers an introduction and overview of this impressive programming environment, including detailed instructions for script writing in Tcl and working with the Tk toolkit. The book also describes the C interfaces for Tcl and Tk for those readers who wish to extend their built-in features by writing new C commands.

John K. Ousterhout, a professor in the Department of Electrical Engineering and Computer Science at the University of California at Berkeley, is the creator of Tcl and Tk. In addition to his work on Tcl and Tk, he is leading the development of a network operating system for high-performance workstations. He is a recipient of the ACM Grace Murray Hopper Award, among numerous other honors. 020163337XAB04062001

1. Introduction.


Introduction.



Organization of the Book.



Notation.



Pronunciation.



Versions.



2. An Overview of Tcl and Tk.


Getting Started.



Hello World with Tk.



Script Files.



Variables and Substitutions.



Control Structures.



On the Tcl Language.



Event Bindings.



Subprocesses.



Additional Features of Tcl and Tk.



Extensions and Applications.

I. THE TCL LANGUAGE.

3. Tcl Language Syntax.


Scripts, Commands, and Words



Evaluating a Command.



Variable Substitution.



Command Substitution.



Backslash Substitution.



Quoting with Double Quotes.



Quoting With Braces.



Comments.



Normal and Exceptional Returns.



More on Substitutions.

4. Variables.


Simple Variables and the Set Command.



Arrays.



Variable Substitution.



Removing Variables: Unset.



Multidimensional Arrays.



The Incr and Append Commands.



Predefined Variables.



Preview of Other Variable Facilities.

5. Expressions.


Numeric Operands.



Operators and Precedence.



Math Functions.



Substitutions.



String Manipulation.



Types and Conversions.



Precision.

6. Lists.


Basic List Structure and the Lindex Command.



Creating Lists: Concat, List, and Llength.



Modifying Lists: Linsert, Lreplace, Lrange, and Lappend.



Searching Lists: Lsearch.



Sorting Lists: Lsort.



Converting Between Strings and Lists: Split and Join.



Lists and Commands.

7. Control Flow.


The If Command.



Looping Commands: While, For, and Foreach.



Loop Control: Break and Continue.



The Switch Command.



The Eval Command.



Executing From Files: Source.

8. Procedures.


Procedure Basics: Proc and Return.



Local and Global Variables.



Defaults and Variable Numbers of Arguments.



Call By Reference: Upvar.



Creating New Control Structures: Uplevel.

9. String Manipulation.


Character Set Issues.



Glob-Style Pattern Matching.



Pattern Matching with Regular Expressions.



Using Regular Expressions for Substitutions.



Generating Strings with Format.



Parsing Strings With Scan.



Extracting Characters: String Index and String Range.



Searching and Comparison.



Length, Case Conversion, and Trimming.

10. Accessing Files.


File Names.



Basic File I/O.



Output Buffering.



Random Access to Files.



The Current Working Directory.



Manipulating File Names: Glob and File.



File Information Commands.



Errors in System Calls.

11. Processes.


Invoking Subprocesses with Exec.



I/O To and From a Command Pipeline.



Process Ids.



Environment Variables.



Terminating the Tcl Process with Exit.

12. Errors and Exceptions.


What Happens after an Error?



Generating Errors from Tcl Scripts.



Trapping Errors with Catch.



Exceptions in General.

13. Managing Tcl Internals.


Querying the Elements of an Array.



The Info Command.



Timing Command Execution.



Tracing Operations on Variables.



Renaming and Deleting Commands.



Unknown Commands.



Autoloading.

14. History.


The History List.



Specifying Events1.



Reexecuting Commands from the History List.



Shortcuts Implemented by Unknown.



Current Event Number: History Nextid.

II. WRITING SCRIPTS FOR TK.

15. An Introduction to Tk.


A Brief Introduction to X.



Widgets.



Applications, Top-Level Widgets, and Screens.



Scripts and Events.



Creating and Destroying Widgets.



Geometry Managers.



Widget Commands.



Commands for Interconnection.

16. A Tour of the Tk Widgets.


Frames.



Toplevels.



Labels.



Buttons, Checkbuttons, and Radiobuttons.



Messages.



Listboxes.



Scrollbars.



Scales.



Entries.



Menus and Menubuttons.



Other Common Options.

17. Geometry Managers: the Packer.


An Overview of Geometry Management.



Packer Basics.



The Pack Command and -Side Options.



Padding.



Filling.



Expansion.



Anchors.



Packing Order.



Hierarchical Packing.



Other Options to the Pack Command.



Other Geometry Managers in Tk.

18. Bindings.


X Events.



An Overview of the Bind Command.



Event Patterns.



Sequences of Events.



Substitutions in Scripts.



Conflict Resolution.



When are Events Processed?



Background Errors: Tkerror.



Other Uses of Bindings.

19. Canvas and Text Widgets.


Canvas Basics: Items and Types.



Manipulating Items with Identifiers and Tags.



Bindings.



Other Canvas Features.



Text Widgets.



Text Indices and Marks.



Text Tags.

20. The Selection.


Selections, Retrievals, and Targets.



Locating and Clearing the Selection.



Supplying the Selection with Tcl Scripts.

21. The Input Focus.


Focus Model: Explicit vs. Implicit.



Setting The Input Focus.



Clearing The Focus.



The Default Focus.



Shortcuts.

22. Window Managers.


Window Sizes.



Gridded Windows.



Window Positions.



Window States.



Decorations.



Window Manager Protocols.



Special Handling: Transients, Groups, and Override-Redirect.



Session Management.



A Warning about Window Managers.

23. The Send Command.


Basics.



Hypertools.



Application Names.



Security Issues.

24. Modal Interactions.


Grabs.



Keyboard Handling During Grabs.



Waiting: The Tkwait Command.

25. More on Configuration Options.


The Option Database.



Option Database Entries.



The RESOURCE_MANAGER Property and .Xdefaults File.



Priorities in the Option Database.



The Option Command.



The Configure Widget Command.

26. Odds and Ends.


Destroying Widgets.



Time Delays.



The Update Command.



Information about Widgets.



Raise and Lower.



The Tk Command: Color Models.



Variables Managed by Tk.

27. Examples.


A Procedure that Generates Dialog Boxes.



A Remote-Control Application.

III. WRITING TCL APPLICATIONS IN C.

28. Philosophy.


C vs. Tcl: Primitives.



Object Names.



Commands: Action-Oriented vs. Object-Oriented.



Representing Information.

29. Interpreters and Script Evaluation.


Interpreters.



A Simple Tcl Application.



Other Evaluation Procedures.



Deleting Interpreters.

30. Creating New Tcl Commands.


Command Procedures.



Registering Commands.



The Result Protocol.



Procedures for Managing the Result.



Clientdata and Deletion Callbacks.



Deleting Commands.



How Tcl Procedures Work.

31. Tcl_AppInit and Packages.


Tcl_AppInit.



Defining Packages.

32. Parsing.


Numbers and Booleans.



Expression Evaluation.



Manipulating Lists.

33. Exceptions.


Completion Codes.



Augmenting the Stack Trace in errorInfo.



Setting errorCode.

34. Accessing Tcl Variables.


Naming Variables.



Setting Variable Values.



Reading Variables.



Unsetting Variables.



Linking Tcl and C Variables.



Setting and Unsetting Variable Traces.



Trace Callbacks.



Whole-Array Traces.



Multiple Traces.



Unset Callbacks.



Nonexistent Variables.



Querying Trace Information.

35. Hash Tables.


Keys and Values.



Creating and Deleting Hash Tables.



Creating Entries.



Finding Existing Entries.



Searching.



Deleting Entries.



Statistics.

36. String Utilities.


Dynamic Strings.



Command Completeness.



String Matching.

37. POSIX Utilities.


Tilde Expansion.



Generating Messages.



Creating Subprocesses.



Background Processes.

IV. TK'S C INTERFACES.

38. Introduction.


What's in a Widget?



The Relationship Between Tk and Xlib.



Square: An Example Widget.



tk.h.



Design for Reusability.

39. Creating Windows.


Windows and Tk_Windows.



Creating Tk_Windows.



Setting a Window's Class.



Deleting Windows.



Basic Operations on Tk_Windows.



Class Command Procedures.



Package Initialization.



Delayed Window Creation.

40. Configuring Widgets.


Tk_ConfigureWidget.



Resource Caches.



Tk_Uids.



Other Translators.



Changing Window Attributes.



The Square Configure Procedure.



The Square Widget Command Procedure.

41. Events.


X Events.



File Events.



Timer Events.



Idle Callbacks.



Generic Event Handlers.



Invoking the Event Dispatcher.

42. Displaying Widgets.


Delayed Redisplay.



Double-Buffering with Pixmaps.



Drawing Procedures.

43. Destroying Widgets.


Basics.



Delayed Cleanup.

44. Managing the Selection.


Selection Handlers.



Claiming the Selection.



Retrieving the Selection.

45. Geometry Management.


Requesting a Size for a Widget.



Internal Borders.



Grids.



Geometry Managers.



Claiming Ownership.



Retrieving Geometry Information.



Mapping and Setting Geometry.



Writing Geometry Managers.

Appendix A. Installing Tcl and Tk.


Versions.



The Master Directory.



Retrieving Distributions with FTP.



Retrieving Distributions with Electronic Mail.



Compiling and Installing the Distributions.



Contributed Extensions.



Comp.lang.tcl newsgroup.

Index. 020163337XT04062001

Erscheint lt. Verlag 11.5.1994
Verlagsort Boston
Sprache englisch
Maße 186 x 234 mm
Gewicht 950 g
Themenwelt Mathematik / Informatik Informatik Programmiersprachen / -werkzeuge
Informatik Weitere Themen Hardware
ISBN-10 0-201-63337-X / 020163337X
ISBN-13 978-0-201-63337-5 / 9780201633375
Zustand Neuware
Haben Sie eine Frage zum Produkt?
Mehr entdecken
aus dem Bereich
entwickle, drucke und baue deine DIY-Objekte

von Stephan Regele

Buch | Hardcover (2023)
Hanser, Carl (Verlag)
34,99