Tcl and Tk CSE 470 Fall 1999 Revised by Prasad. Objective To use Tcl Tk to develop GUI and prototype of the project.

Slides:



Advertisements
Similar presentations
Tk. Toolkit n Wish - windowing shell –touch fileName –chmod +x fileName –xedit fileName & –#!/usr/local/bin/wish n Widgets - eg Buttons, Labels, Frames.
Advertisements

Tk Widgets This material is best on several sources –Slides by Dr. Ernest J. Friedman-Hill –various Tcl/Tk books.
Pages and boxes Building quick user interfaces. learning objectives o Build a quick UI with pages and boxes o understand how pages and boxes work o click.
Noadswood Science,  To know how to use Python to produce windows and colours along with specified co-ordinates Sunday, April 12, 2015.
JavaScript FaaDoOEngineers.com FaaDoOEngineers.com.
LAB 3 NS2 Preliminaries. Contents TCL/OTCl Fundamentals Creating Network Setting Connections Generating Traffic Inserting Errors Configuring for multicast.
Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
Shell Programming Software Tools. Slide 2 Shells l A shell can be used in one of two ways: n A command interpreter, used interactively n A programming.
Text Box controls are used when users are required to type some input (during program execution), or output is displayed on the form (known as the user-
Tcl/Tk 1 CS 414, Software Engineering I Mark Ardis Rose-Hulman Institute December 3, 2002.
Introduction to Tcl and Tk Outline –The Tcl Language –The Tk Toolkit –Tk Applications –Composing Applications –Status and Conclusions Goal –Understand.
Programming for Image Processing/Analysis and Visualization using The Visualization Toolkit Week 2: An Introduction to Tcl Xenios Papademetris
Review CSC 171 FALL 2004 LECTURE 21. Topics Objects and Classes Fundamental Types Graphics and Applets Decisions Iteration Designing Classes Testing and.
To type the VB code behind the command button (named cmdPush), Double-Click on the Push Me (caption) command button As a result the Visual Basic Code Window.
IS 1181 IS 118 Introduction to Development Tools VB Chapter 03.
Various widget enhancements and self- explanatory widgets applications of Tcl/Tk GUI Author:Rahul Dashore Mentor Graphics Presenter: Tony Johnson Mentor.
Day 4 Objectives Constructors Wrapper Classes Operators Java Control Statements Practice the language.
An Overview of Tcl and Tk John Ousterhout Sun Microsystems Laboratories Tcl/Tk Tutorial, Part I.
SAD and Python with EPICS at IHEP,Beijing, Noboru Yamamoto KEK, JAPAN.
Innovation Intelligence ® 1 Chapter 1: Introduction to TCL.
Chapter 8 High-Level Programming Languages (modified by Erin Chambers)
Tcl/Tk package in R Yichen Qin
PYTHON. Python is a high-level, interpreted, interactive and object- oriented scripting language. Python was designed to be highly readable which uses.
Tcl/Tk: An introduction D. Kim, K. Kundu, and M. Siegel November 26, 2002 CMSC 631.
Advanced BioPSE NCRR SCIRun GUI Guidelines J. Davison de St. Germain Chief Software Engineer SCI Institute December 2003 J. Davison de St.
Extending HTML CPSC 120 Principles of Computer Science April 9, 2012.
Advanced EPICS Training, Dirk Zimoch 2008 Channel Access in Tcl/Tk.
PYTHON GUI PROGRAMMING
University of Sunderland CIF 102/FIF102 Fundamentals of DatabasesUnit 15 Programming in Microsoft Access using VBA Using VBA to add functionality.
1 Computer Science of Graphics and Games MONT 105S, Spring 2009 Session 20 Graphical User Interface (GUI)
CC111 Lec7 : Visual Basic 1 Visual Basic(1) Lecture 7.
CNS 1410 Graphical User Interfaces. Obectives Students should understand the difference between a procedural program and an Event Driven Program. Students.
Applications Development
JavaScript Scripting language What is Scripting ? A scripting language, script language, or extension language is a programming language.
Practical Programming COMP153-08S Week 5 Lecture 1: Screen Design Subroutines and Functions.
Shell Programming Learning Objectives: 1. To understand the some basic utilities of UNIX File 2. To compare UNIX shell and popular shell 3. To learn the.
Copyright © 2015 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 13 GUI Programming.
Tkinter Basics. Initial Stuff To get the package: from tkinter import * To make a window, give it a title and operate it: windowVar = Tk() windowVar.title(“your.
9-Nov-97Tri-Ada '971 TASH An Alternative to the Windows API TRI-Ada ‘97 Terry J. Westley
TCL TK. Tcl/Tk C functions can become Tcl commands that are invoked interactively Tk = scriptable, portable user interface –Windows, X (Unix), MacOS,
Creating visual interfaces in python
Introduction to Tcl/Tk TraNese Christy U.S. Army Research Laboratory.
Innovation Intelligence ® 1 Chapter 4: Using TCL to Control the HyperMesh Session.
CMPF114 Computer Literacy Chapter 3 The Visual Basic Environment 1.
 Stands for Tool Command Language  Used for rapid prototyping, GUIs, and scripted applications  Created by John Ousterhout in 1988 out of frustration.
An Overview of Tcl/Tk Programming. Tcl/Tk Tcl (Tool Command Language) is used by over half a million developers worldwide and has become a critical component.
Announcements Assignment 1 due Wednesday at 11:59PM Quiz 1 on Thursday 1.
Scripting.
Batch Files Flow of Control to Strengthen Copyright © by Curt Hill.
Perl Ed Finegan. Overview of Pearl Perl is a high-level programming language written by Larry Wall. It derives from the C programming language and to.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 6 Looping and Multiple Forms.
Tcl/Tk Part 2.
Perl & TCL Vijay Subramanian, Modified from : perl_basics_06.ppt.
Introduction to.
VISUAL BASIC 6.0 Designed by Mrinal Kanti Nath.
Tk Widgets in Javascript
Topics Graphical User Interfaces Using the tkinter Module
Chapter 21 – Graphics/Tk Outline 21.1 Introduction 21.2 GD Module: Creating Simple Shapes 21.3 GD Module: Image Manipulation 21.4 Chart Module 21.5 Introduction.
Introduction to Computer CC111
Console and GUI Programs
My Final Project: Calorie Counter
Prepared By: G.UshaRani B.Pranalini A.S.Lalitha
Henning Schulzrinne Advanced Programming
TCL/TK Tool Command Language/Tool Kit.
This Week: Tkinter for GUI Interfaces Some examples
Tkinter GUIs Computer Science and Software Engineering
VISUAL BASIC.
Visual Basic: Week 5 Review User defined functions
Topics Graphical User Interfaces Using the tkinter Module
LING 408/508: Computational Techniques for Linguists
Presentation transcript:

Tcl and Tk CSE 470 Fall 1999 Revised by Prasad

Objective To use Tcl Tk to develop GUI and prototype of the project

What is Tcl/Tk ? Tcl (Tools Command Lanuage): is a simple string based scripting language for controlling and extending applications. Tcl provides generic programming facilities such as variables, loops, and procedures. Tk: a Tool kit based on X-window system. Tk provides facilities (widgets) for building user interfaces. Tcl/Tk are excellent tools for Rapid prototyping.

Tcl/Tk.. continued Tcl/Tk is interpreted rather than compiled ( The interpreter is in !/opt/bin/wish ) It is a weakly typed language (strings and integer variables are interchangeable). Tcl syntax is very much similar to UNIX shell programming.

Tcl primitives Assignment Value set name “ “ set ID 8989 set number IDID set number $ID89 if statement: if {$turn == “0”} { computer_move } else { player_move }

Tcl Primitives Procedures, expressions … proc diag {a b} { set c [expr sqrt($a * $a + $b * $b) ] return $c } Loops (the while loop) while {$i <= 10} { set I [expr $i+1] }

Tk Fundamentals Tk provides commands for creating and manipulating widgets. Widgets types include buttons, scroll bars, text boxes, scales, canvas etc. The three step procedure for creating a widget. 1) Declare the widget 2) Define any event procedure 3) Pack the Widget.

A simple example: Push Button Declaring the widget button.pushbutton -text pushme -command procpush Defining Event Procedure proc procpush {} {.pushbutton config -text “I am pushed” } Packing pack.pushbutton -side top Execute the script wish filename.tk

Simple Example: contd...

Naming conventions Widgets should be referred in a hierarchical fashion. Names of all top level widgets start with a “. “ (period). Example: Say we have top level entity as frame and inside it we have a button. frame.entryframe button.entryframe.pushbutton -text “push me” Thus all widgets have a parent-child relationship.

Timer The after command: after 1000 Makes the program wait for 1000ms before proceeding further. after 1000 proc Fires the procedure proc after 1000ms but proceeds immediately to the next statement after after statement.

Example 2

Examples of widgets Canvas canvas.colorwin -width 7c -height 2c Scale scale.redscale -label Red -from 0 -to 255 -length 7c Frame frame.entryframe Text Box entry.entryframe.Namebox -width 7 -height 2