Is anyone familiar enough with the tcltk2 package to know if it is possible to have an entry box where a user can enter information (such as a path to a file or a number) and then be able to use the entered information downstream in a R script ? The idea is for someone unfamiliar with R to just start an R script that would take care of all the commands for them so all they have to do is get the script started. However, there is always a couple of pieces of information that will change each time the script is used (for example, a different file will be processed by the script). So, I would like a way for the user to input that information as the script ran. Matthew McCormack
Dear Matthew, For file selection, see ?tcltk::tk_choose.files or ?tcltk::tkgetOpenFile . You could enter a number in a tk entry widget, but, depending upon the nature of the number, a slider or other widget might be a better choice. For a variety of helpful tcltk examples see <http://www.sciviews.org/_rgui/tcltk/>, originally by James Wettenhall but now maintained by Philippe Grosjean (the author of the tcltk2 package). (You probably don't need tcltk2 for the simple operations that you mention, but see ?tk2spinbox for an alternative to a slider.) Best, John ----------------------------------------------- John Fox, Professor McMaster University Hamilton, Ontario, Canada http://socserv.socsci.mcmaster.ca/jfox/> -----Original Message----- > From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Matthew > Sent: July-08-15 8:01 PM > To: r-help > Subject: [R] tcltk2 entry box > > Is anyone familiar enough with the tcltk2 package to know if it is > possible to have an entry box where a user can enter information (such > as a path to a file or a number) and then be able to use the entered > information downstream in a R script ? > > The idea is for someone unfamiliar with R to just start an R script that > would take care of all the commands for them so all they have to do is > get the script started. However, there is always a couple of pieces of > information that will change each time the script is used (for example, > a different file will be processed by the script). So, I would like a > way for the user to input that information as the script ran. > > Matthew McCormack > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.--- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
Wow ! Very nice. Thank you very much, John. This is very helpful and just what I need. Yes, I can see that I should have paid attention to tcltk before going to tcltk2. Matthew On 7/8/2015 8:37 PM, John Fox wrote:> Dear Matthew, > > For file selection, see ?tcltk::tk_choose.files or ?tcltk::tkgetOpenFile . > > You could enter a number in a tk entry widget, but, depending upon the > nature of the number, a slider or other widget might be a better choice. > > For a variety of helpful tcltk examples see > <http://www.sciviews.org/_rgui/tcltk/>, originally by James Wettenhall but > now maintained by Philippe Grosjean (the author of the tcltk2 package). (You > probably don't need tcltk2 for the simple operations that you mention, but > see ?tk2spinbox for an alternative to a slider.) > > Best, > John > > ----------------------------------------------- > John Fox, Professor > McMaster University > Hamilton, Ontario, Canada > http://socserv.socsci.mcmaster.ca/jfox/ > > > > >> -----Original Message----- >> From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Matthew >> Sent: July-08-15 8:01 PM >> To: r-help >> Subject: [R] tcltk2 entry box >> >> Is anyone familiar enough with the tcltk2 package to know if it is >> possible to have an entry box where a user can enter information (such >> as a path to a file or a number) and then be able to use the entered >> information downstream in a R script ? >> >> The idea is for someone unfamiliar with R to just start an R script that >> would take care of all the commands for them so all they have to do is >> get the script started. However, there is always a couple of pieces of >> information that will change each time the script is used (for example, >> a different file will be processed by the script). So, I would like a >> way for the user to input that information as the script ran. >> >> Matthew McCormack >> >> ______________________________________________ >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> 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. > > --- > This email has been checked for viruses by Avast antivirus software. > https://www.avast.com/antivirus >