[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
tcl/tk and octave source files
From: |
Thierry CHATEAU |
Subject: |
tcl/tk and octave source files |
Date: |
Wed, 28 Oct 1998 09:57:27 +0100 |
Ok, here are the two source files that i just tested yesterday.
M file : test1.m
O open the pipe
fid=popen("./ess1.tcl","r");
%read the stdout of the process ess1.tcl
while( isstr (s=fgets(fid)));
% eval the string s
eval([s ]);
endwhile;
%END OF FILE
__________________
tcl/tk file : ess1.tcl
#!/usr/bin/wish
wm title . "Octave test1"
wm minsize . 20 20
# the frame
frame .buttons -borderwidth 10
pack .buttons -side top -fill x
# scale (slide)
scale .buttons.reg1 -variable v1 -label var1 -from 1 -to 50
pack .buttons.reg1
#
#buttons
button .buttons.quit -text Quit -command exit
button .buttons.send -text Send -command Octave
button .buttons.next -text >> -command {
set v1 [expr $v1+1] ;
Octave }
button .buttons.previous -text << -command {
set v1 [expr $v1-1] ;
Octave}
pack .buttons.quit .buttons.send .buttons.next .buttons.previous -side
right
#
# Entry
frame .f ; pack .f -side top
label .f.l -text Command:
entry .f.command -width 20 -relief sunken
pack .f.l .f.command -side left
#
# When return on f : execute proc Octave2
bind .f.command <Return> Octave2
#
# Octave proc
proc Octave {} {
set tmp [.f.command get]
set tmp [ .buttons.reg1 get ]
puts stdout $tmp
}
# Octave2 proc
proc Octave2 {} {
set tmp [.f.command get]
puts stdout $tmp
}
#END OF FILE
__________________________________________
Ok : this is a very simple example. With popen and the option "r", it is
only possible to read the stdout of the process.
It just display a wondows with buttons, a slide and a command line.
To start the GUI, you just have to run the m. file under octave. It
works
beter if the variable page_screen_output=0 ;
Yesterday, i tried to use popen2 in order to create a 2 way
communication
with the tcl/tk process. But, it does not work yet.
I hope these files will help you.
Ps : it work with tlc/tk all versions (i think) and octave V2.0.9 under
linux
--
________________________________________________
/\ \
\_| Thierry CHATEAU |
| _______________ |
| CEMAGREF |
| Groupement de Clermont-Ferrand |
| 24, Avenue des Landais, |
| BP 50085, 63172 AUBIERE Cedex 1 |
| _______________ |
| mailto:address@hidden |
| |
| Tel : 33.4.73.44.07.48 |
| Fax : 33.4.73.44.06.97 |
| ____________________________________________|_
\_/_____________________________________________/
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- tcl/tk and octave source files,
Thierry CHATEAU <=