1 Tcl/Tk package in R Yichen Qin Department of Applied Mathematics and Statistics December 5, 2008.
-
Upload
randell-mcdowell -
Category
Documents
-
view
216 -
download
0
Transcript of 1 Tcl/Tk package in R Yichen Qin Department of Applied Mathematics and Statistics December 5, 2008.
2
Today’s schedule Introduction to Tcl/Tk package in R. Basic concepts in Tcl/Tk package Some basic example Some fancy examples (if time
permitted)
4
What is Tcl? Tcl, or the "Tool Command
Language", is a powerfully simple, open source-licensed programming language. Tcl provides basic language features such as variables, procedures, and control structures. It runs on almost any modern OS. But the key feature of Tcl is its extensibility.
5
What is Tk? Tk is a Tcl extension, written in C,
designed to give the user a relatively high level interface to his or her windowing environment.
GUI (Graphical user interface) extension
6
What is Tcl/Tk? Tcl/Tk is a combination of a
scripting language and a toolkit for graphical user interfaces.
7
What is Tcl/Tk package in R? The Tcl/Tk package allows the use
of the Tk graphical user interface elements from within R by embedding Tk commands into the R language, and replacing Tcl code with R function calls.
8
Who developed it? Peter Dalgaard developed this
package. He is a professor at Department of
Biostatistics, University of Copenhagen
Most examples and materials in our class are from by him.
10
Learning Method The best way to learn Tcl/Tk
package is through examples. There are relatively limited
material for this package, compare to other packages.
The commands are so many that no textbook will cover them all. So learning while using is the best way.
11
Learning material http://www.sciviews.org/_rgui/tcltk/ http://bioinf.wehi.edu.au/
~wettenhall/RTclTkExamples/ http://www.r-project.org/
13
A basic component: Widget A widget is a GUI (Graphical user
interface) element. It can be: buttons, listboxes, text
editing windows, sliders, text entry fields, labels, menus, and a canvas for drawing graphics.
15
Geometry managers A geometry manager controls the
placement of widgets within a master widget.
Tkplacer() --- hardly used Tkpack() --- places widgets in order
around edges of cavity based on a order and a direction.
Tkgrid() --- lays out widgets in rows and columns
18
Connect widgets with R We need a way to get data from
widgets to and from R, and a way to make things happen in response to widget events.
Tkconfigure() --- value-related Tkbind() --- action-related
21
Creat a menu Menus are created in several steps. First
you setup the menu with tkmenu(), then you add items with tkadd(). There are so many possible options for a menu item that this is a more practicable approach.
Add menu backwards Tkmenu() Tkadd()
25
Some advance examples with Tcl/Tk and rpanel Rpanel is also a package that
developed based on Tcl/Tk.
26
Advanced examples http://www.stats.gla.ac.uk/~adrian/rpan
el/ R-prog15.R R-prog16.R R-prog17.R R-prog18.R R-prog19.R R-prog20.R