Description Usage Arguments Details Examples
Add binds to previous defined bindings
1 |
win |
window |
event |
event |
fun |
a function |
This function adds a new bind while keeping the previous defined binds.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ## Not run:
tt <- tktoplevel()
tt <- tkRplot(tt, function () plot(1:10))
FUN <- local({
canPos <-.Tcl(paste(tt$env$canvas, "create text 0 0 "))
function (x, y) {
x <- as.numeric(x)
y <- as.numeric(y)
tkdelete(tt$env$canvas, tclvalue(canPos))
xy <- formatC(tk2usr(x, y),
digits = 2,
format = "f",
width = 5)
canPos <<- .Tcl(
paste(tt$env$canvas, "create text 40 10 -fill blue -justify left -text { ",
xy[1], " ", xy[2],
"} -font {Helvetica -10}"))
}})
tkbind(tt$env$canvas, "<Motion>", FUN)
tkbind(tt$env$canvas, "<Motion>") #to give current bidings
FUN1 <- function (x,y) print(tk2usr(x,y))
addTkBind(tt$env$canvas, "<Motion>", FUN1)
tkbind(tt$env$canvas, "<Motion>") #to give current bidings
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.