Closed MuriloMir closed 3 years ago
Just call the flushGui();
function in your own loop, sdpy exposes that for exactly this kind of thing.
Flushing on every call is inefficient in general.
I added a note to the documentation telling about how it needs to be flushed since doing it automatically is often the wrong thing to do. The doc note though should clear it up so gonna close this.
If you want to press a key repeatedly with a time interval then you need to flush the GUI every time you do it. For instance, supposing you want to create a program that keeps pressing F5 to reload a web page every 5 seconds. I tried using the code below and it didn't work until I added the flush function: SyntheticInput fake = SyntheticInput(0); bool forever = true; while (forever) { fake.pressKey(Key.F5, true); fake.pressKey(Key.F5, false); Thread.sleep(5.seconds); }