I would like to make a simple "game": Display a dialog with a random letter, if the same letter is pressed on the keyboard, the display changes into a string "Correct", and after a while a new random letter is generated.
However, in the below code, I am unable to get the "Correct" displayed on the screen. The Dynamic does not update timely.
rand := RandomChoice[FromCharacterCode /@ Join[Range[65, 90]]]; display = rand; CreateDialog[ Dynamic[Style[display, 600], TrackedSymbols :> {display}], NotebookEventActions -> {"KeyDown" :> Module[{k = Capitalize@CurrentValue@"EventKey", x = display}, If[x === k, display = "Correct"; Pause[1]; display = rand]]}] How to make it work?