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



Attachment: signature.asc
Description: OpenPGP digital signature

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to