Re: [R] readline() for passwords?

From: Barry Rowlingson <>
Date: Thu 16 Feb 2006 - 21:27:45 EST

Ulf Mehlig wrote:

> I am using RODBC to access a password-protected database. Is there a
> possibility to prevent that the password appears on the screen when
> issuing the odbcConnect() command? I thought of something like
> readline() without echo. I guess that a getpass()-based solution
> wouldn't work for ESS/Emacs, anyway, would it?

tk has a way of doing this, so you can build a function that uses the tcltk package. Something like:

getPassword <- function(){

   tt <- tktoplevel()
   label.widget <- tklabel(tt, text="Enter Password")    password.widget <- tkentry(tt,show="*",textvariable=pass)    ok <- tkbutton(tt,text="Ok",command=function()tkdestroy(tt))    tkpack(label.widget, password.widget,ok)    tkwait.window(tt)

The vital part here is the 'show="*"' option in the tkentry widget.

Of course this is no use if you aren't in a graphical environment at the time.

Barry mailing list PLEASE do read the posting guide! Received on Thu Feb 16 21:40:25 2006

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 14:08:29 EST