[R] tkentry that exits after RETURN?
Ben Bolker
bolker at zoology.ufl.edu
Mon Aug 11 20:23:06 CEST 2008
I can set up an entry widget (thanks to an old
post by Barry Rowlingson) that gets a password and
exits when the user clicks on the "OK" button.
Anyone have any clever ideas for returning/
destroying the window when the user types a carriage
return/ENTER in the text window? I've messed around
a little with validate, validatecommand, but don't
see any obvious way to do it ...
getPassword <- function(){
require(tcltk)
tt <- tktoplevel()
pass=tclVar("")
label.widget <- tklabel(tt, text="Enter Password")
password.widget <- tkentry(tt,show="*",textvariable=pass)
ok <- tkbutton(tt,text="OK",default="active",
command=function()tkdestroy(tt))
tkpack(label.widget, password.widget,ok)
tkwait.window(tt)
return(tclvalue(pass))
}
thanks
Ben Bolker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20080811/8396b09c/attachment.bin>
More information about the R-help
mailing list