[R] re trieve user input from an tcl/tk interface

einsundeins floriansense at gmail.com
Mon Sep 28 22:02:10 CEST 2009


Hello everyone,

this is my first post here and I hope I signed up correctly and someone will
take me by the hand and help me out. I am new to R and cannot figure out
what to do here...

... I want to have an User Interface that requests input. I want to save
this input to a variable to use it later on. I was able to do this with a
modalDiaglog (
http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/modalDialog.html like
this ) but I cannot figure out how to do this with multiple values to be
read.

I want to run a rather simple simulation and the user has to be able to set
multiple parameters (say, number of trials and stimuli). The onOK-function
should then "collect" these parameters and save them to variables (I guess). 

Here is a snippet of my code. Could someone tell me what to do? Am I heading
in the right direction or is my approach hopeless? :p

-------------------------------------------------------------
OnOK = function(){
	# I reckon this is where the important stuff should happen...
	tkdestroy(tt)
}

require(tcltk)
tclRequire("BWidget")
tt = tktoplevel()

trials = tclVar("100")         # I want to suggest default values but they
should be editable.
entry.trials = tkentry(tt, width = "3", textvariable = trials)
tkgrid(tklabel(tt,text="Number of trials:"))
tkgrid(entry.trials)

Stimuli = tclVar("10")        # I want to suggest default values but they
should be editable.
entry.Stimuli = tkentry(tt, width = "3", textvariable = Stimuli)
tkgrid(tklabel(tt, text = "Number of stimuli:"))
tkgrid(entry.Stimuli)

OK.but = tkbutton(tt,text="   Go!   ",command=OnOK)
tkgrid(OK.but)
tkfocus(tt)
-------------------------------------------------------------

Of course, I also tried to find a solution via google but couldn't really
find anything.  http://tolstoy.newcastle.edu.au/R/e4/help/08/07/17422.html
The only thing I found was this post which never got answered . I hope
someone can help. Thank you very much for reading this and any help is
greatly appreciated!

Best regards,
Florian
-- 
View this message in context: http://www.nabble.com/retrieve-user-input-from-an-tcl-tk-interface-tp25651905p25651905.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list