Question

in R there are several ways to wait for an input from the user, such as clicking somewhere on a graph (e.g. locator() function).

I'm looking for an option to record the user input WITHOUT waiting for it. I'm running a for loop with a locator() function in it, but this function prevents the for loop to progress unless the user click on something.

Any idea on how to overcome this?

Was it helpful?

Solution

Your best option is probably to use another GUI toolset, tcltk is one option. You can create a plot and display it in a Tk window, then set up a handler that will change a variable value if the user clicks on the plot, then you can have your loop doing other calculations and just check periodically if the variable set by the handler has changed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top