[R] help with tktag.bind

From: <solares_at_unsl.edu.ar>
Date: Tue 20 Jul 2004 - 07:59:38 EST


Hi, i newbee in R and not understand the command tktag.bind, the code below not work find, (not change the foreground to red at move the cursos on the lines in the tktext and the for sentence appear not work) Why is this?Thanks

library(tcltk)
tt<-tktoplevel()
editor<-tktext(tt)
tkpack(editor)

tkinsert(editor,"1.0","first line \n")
tkinsert(editor,"2.0","Second line \n")
tkinsert(editor,"3.0","Third line \n")

cambio1<-function(t){
         tktag.configure(editor,t,foreground="red")

}
cambio2<-function(t){ tktag.configure(editor,t,foreground="black")
}
tktag.add(editor,"t1","1.0","1.end")

tktag.add(editor,"t2","2.0","2.end")
tktag.add(editor,"t3","3.0","3.end")
tkbind(editor,"<ButtonPress-1>",cambio1) tkbind(editor,"<ButtonRelease-1>",cambio2) hello<-function() print("hello")
tktag.bind(editor,"t1","<1>",hello)
tktag.bind(editor,"t1","<Motion>",cambio1(t1))
tktag.bind(editor,"t1","<Leave>",cambio2(t1))

l<-c("t1","t2","t3")
for (t in l)
tktag.bind(editor,t,"<Motion>",tktag.configure(editor,t,foreground="red")) for (t in l)
tktag.bind(editor,t,"<Leave>",tktag.configure(editor,t,foreground="black"))



R-help@stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Tue Jul 20 08:06:14 2004

This archive was generated by hypermail 2.1.8 : Wed 03 Nov 2004 - 22:55:05 EST