Suppose I use a Button[]
to make some event occur, how can I make the pressing of this button keep that event occurring at a controlled rate? I tried the following:
x = 0;
Button["X", Dynamic[Refresh[x = x + 1, UpdateInterval -> 1]]]
Dynamic[x]
But it doesn't keep repeating the event x=x+1
if the button keeps pressed. If there is some neater/better alternative without Button[]
, I'm open to it.