Tcl/Tk 2 CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute December 5, 2002.

Slides:



Advertisements
Similar presentations
Chapter 3: Control Flow S. M. Farhad. Statements and Blocks An expression becomes a statement when it is followed by a semicolon Braces { and } are used.
Advertisements

This Time Whitespace and Input/Output revisited The Programming cycle Boolean Operators The “if” control structure LAB –Write a program that takes an integer.
CIS 240 Introduction to UNIX Instructor: Sue Sampson.
Microsoft Excel Presented by ShoWorks Fair Software and Online Entries
Introduction to C Programming
Tcl and Otcl Tutorial Part I Internet Computing KUT Youn-Hee Han.
Programming Using Tcl/Tk These slides are based upon u several Tcl/Tk text books u material byDr. Ernest J. Friedman-Hill.
0 Chap. 3 Control Flow 3.1 Statements and Blocks Imperative Programming, B. Hirsbrunner, diuf.unifr.ch/pai/ip Session 4, 3 April if, if … else.
Homework Any Questions?. Statements / Blocks, Section 3.1 An expression becomes a statement when it is followed by a semicolon x = 0; Braces are used.
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
1 Introducing ASML Sequences, Parallel evaluation, Maps, Non-Determinism Lecture 12 Software Engineering COMP201.
Tcl/Tk 1 CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute December 3, 2002.
CS1061 C Programming Lecture 2: A Few Simple Programs A. O’Riordan, 2004.
 2007 Pearson Education, Inc. All rights reserved Introduction to C Programming.
Writing Tcl Scripts Outline Goal Reading Syntax Data Types
Tutorial 4 Decision Making with Control Structures and Statements Section A - Decision Making JavaScript Tutorial 4 -Decision Making with Control.
C++ for Engineers and Scientists Third Edition
Guide To UNIX Using Linux Third Edition
Introduction to C Programming
Introduction to Unix (CA263) Introduction to Shell Script Programming By Tariq Ibn Aziz.
CTEC 1863 – Operating Systems Shell Scripting. CTEC F2 Overview How shell works Command line parameters –Shift command Variables –Including.
Innovation Intelligence ® 1 Chapter 1: Introduction to TCL.
Chapter 5 Menus, Common Dialog Boxes, and Methods Programming in C#.NET © 2003 by The McGraw-Hill Companies, Inc. All rights reserved.
1 Chapter 4: Selection Structures. In this chapter, you will learn about: – Selection criteria – The if-else statement – Nested if statements – The switch.
COMPUTER PROGRAMMING. Control Structures A program is usually not limited to a linear sequence of instructions. During its process it may repeat code.
Dr. Yang, QingXiong (with slides borrowed from Dr. Yuen, Joe) LT3: Conditional Statements CS2311 Computer Programming.
CPS120: Introduction to Computer Science Decision Making in Programs.
Chapter 3 Control Flow Ku-Yaw Chang Assistant Professor, Department of Computer Science and Information Engineering Da-Yeh University.
4 1 Array and Hash Variables CGI/Perl Programming By Diane Zak.
Intro to More Controls in C#. C# Demonstration We already touched on labels and buttons Ad-hoc demo of controls – Textboxes Multiline – Checkbox – Radiobutton.
Simple Control Structures IF, IF-ELSE statements in C.
Programming Fundamentals. Today’s Lecture Why do we need Object Oriented Language C++ and C Basics of a typical C++ Environment Basic Program Construction.
PHP Conditional Statements Conditional statements in PHP are used to perform different actions based on different conditions. Conditional Statements Very.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 2: Variables & Data Types.
Open Source Server Side Scripting ECA 236 Open Source Server Side Scripting MySQL – Inserting Data.
ITIP © Ron Poet Lecture 12 1 Finding Out About Objects.
Chapter 05 (Part III) Control Statements: Part II.
Chapter 8: Statement-Level Control Structures
Introducing Python CS 4320, SPRING Resources We will be following the Python tutorialPython tutorial These notes will cover the following sections.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
LIN Unix Lecture 5 Unix Shell Scripts. LIN Command Coordination ; && || command1 ; command2 Interpretation: Do command 1. Then do command.
CPS120 Introduction to Computer Science Iteration (Looping)
Introduction to Tcl/Tk TraNese Christy U.S. Army Research Laboratory.
CS001 Introduction to Programming Day 2 Sujana Jyothi
CPS120: Introduction to Computer Science Decision Making in Programs.
Haskell Basics CSCE 314 Spring CSCE 314 – Programming Studio Using GHC and GHCi Log in to unix.cse.tamu.edu (or some other server) From a shell.
Scripting.
CSC 4630 Meeting 17 March 21, Exam/Quiz Schedule Due to ice, travel, research and other commitments that we all have: –Quiz 2, scheduled for Monday.
Introduction to Programming the WWW I CMSC Winter 2003 Lecture 17.
CSC 4630 Perl 3 adapted from R. E. Beck. Problem But we worked on it first: Input: Read from a text file named in a command line argument Output: List.
Unit – 3 Control structures. Condition Statements 1.If.…..else :- Has someone ever told you, "if you work hard, then you will succeed"? And what happens.
Tcl/Tk Part 2.
Oracle 10g Retrieving Data Using the SQL SELECT Statement.
An Introduction To Tcl Scripting John Ousterhout Sun Microsystems Laboratories Tcl/Tk Tutorial, Part II.
TCL/TK Tool Command Language/Tool Kit. What is TCL? u Tool Command Language u An interpreted programming language  Created by John Ousterhout.John Ousterhout.
Perl & TCL Vijay Subramanian, Modified from : perl_basics_06.ppt.
CSC 4630 Meeting 7 February 7, 2007.
Programmation impérative - Prof. Béat Hirsbrunner
Miscellaneous Items Loop control, block labels, unless/until, backwards syntax for “if” statements, split, join, substring, length, logical operators,
TCL/TK Tool Command Language/Tool Kit.
2.0 FUNDAMENTALS OF JAVA PROGRAMMING LANGUAGE
CS1100 Computational Engineering
CSC215 Lecture Flow Control.
JavaScript What is JavaScript? What can JavaScript do?
CSC215 Lecture Control Flow.
Homework Any Questions?.
C Programming Getting started Variables Basic C operators Conditionals
CSC 352– Unix Programming, Fall 2012
Introduction to Bash Programming, part 3
CSC215 Lecture Control Flow.
Presentation transcript:

Tcl/Tk 2 CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute December 5, 2002

2 Outline Tcl syntax Menus Key bindings Expression evaluation Control structures

3 Tcl Syntax 1/3 Every Tcl statement begins with a command: set foo $bar button $tw.2.b1 -text "7"... foreach col { }...

4 Tcl Syntax 2/3 Whitespace (spaces or tabs) separates a command from its arguments (and arguments from one another) Newline or semicolon ends a command Use \ to continue a command on another line

5 Tcl Syntax 3/3 Double quotes and curly braces are used to group words together into one argument Quotes allow substitutions to occur Curly braces do not allow substitutions

6 Menus Use menu to create a menu menu $tw.menu -tearoff 0 Use configure -menu to attach a menu to $tw configure -menu $tw.menu

7 More Menus Use add command to add an entry to a menu $m add command -label "Quit" -command Quit

8 Binding keys The bind command takes 3 arguments –a widget (where the binding has effect) –a key sequence –a command bind $tw "Quit"

9 Expression Evaluation Expressions are evaluated by invoking the expr command set len [expr $foo + 3] Note that square brackets enclose commands

10 Control Structures foreach (saw earlier) if switch exit

11 if if {condition} { statements } else { statements } if {$x == 0} { puts stderr "Divide by zero" } else { set slope [expr $y / $x] }

12 switch switch { { statements }... default { statements } } switch $foo { bar { set x 0 } baz { set x 1 } }

13 exit exit terminates the application