質問

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?

役に立ちましたか?

解決

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top