rawpython / remi

Python REMote Interface library. Platform independent. In about 100 Kbytes, perfect for your diet.
Apache License 2.0
3.48k stars 401 forks source link

Interface update Interval? #442

Closed rp10007 closed 3 years ago

rp10007 commented 3 years ago

I'm using PySimpleGuiWeb to control an embedded device, and part of the interface changes the color of a button to indicate the state of the underlying hardware:

if gm.leftlaser:
    window['Toggle Left Laser'].update(button_color = ('black','light blue'))

The update currently takes about 11 seconds. (The code is running on a Pi 3, and the time seems to be spent in the interface, because the laser turns on/off as soon as I click the button in the browser window running on a machine across the room.) I've tried messing with the web_update interval, from the default 0.0001 to 0.5 and 0. Any change is within my stopwatch margin of errror. Also no apparent change if I use window.FindElement.

Is there anything I can tweak to reduce this lag? Am I doing something obviously wrong, or is the problem perhaps on the PySimpleGui side?

dddomodossola commented 3 years ago

Hello @rp10007 , 11 seconds is really too much time. However it is difficult to know where this error comes from by this description. Can you try one remi example on your rpi and check if it updates correctly?

rp10007 commented 3 years ago

I tried the minefield app, and everything there updates almost instantly. So that's not the problem. And I put some time calls in various places -- the update itself takes only a few tens of milliseconds.

I'm sorry -- after checking thoroughly where the time was being spent in my code I found a read-with-timeout that was absolutely guaranteed not to trigger the timeout but did anyway. Thanks for the quick response, and for eliminating remi as a candidate for what might have been wrong.

dddomodossola commented 3 years ago

You are welcome ;-)