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 >
If you want you script to wait until you have a value entered then you can use the tkwait.variable or tkwait.window commands to make the script wait before continuing (or you can bind the code to a button so that you enter the value, then click on the button to run the code). On Wed, Jul 8, 2015 at 7:58 PM, Matthew McCormack <mccormack at molbio.mgh.harvard.edu> wrote:> 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 >> > > ______________________________________________ > 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.-- Gregory (Greg) L. Snow Ph.D. 538280 at gmail.com
Thank you very much, Greg, for the tkwait commands. I am just starting to try out examples on the sciviews web page to get a feel for tcltk in R and the tkwait.variable and tkwait.window seem like they could be very useful to me. I will add these in to my practice scripts and see what I can do with them. Matthew On 7/9/2015 5:31 PM, Greg Snow wrote:> If you want you script to wait until you have a value entered then you > can use the tkwait.variable or tkwait.window commands to make the > script wait before continuing (or you can bind the code to a button so > that you enter the value, then click on the button to run the code). > > On Wed, Jul 8, 2015 at 7:58 PM, Matthew McCormack > <mccormack at molbio.mgh.harvard.edu> wrote: >> 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 >>> >> ______________________________________________ >> 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. > >