rawpython / remi

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

Flickering when bundled via Pyinstaller in windows 7 #289

Open FaizRasool opened 5 years ago

FaizRasool commented 5 years ago

I have created executable in windows 10 using pyinstaller using the command below:

pyinstaller.exe --clean --windowed --noconsole --hidden-import "clr" main.py --add-data "C:\Users\User\AppData\Local\Programs\Python\Python36\Lib\site-packages\webview\lib\WebBrowserInterop.x64.dll;./" --add-data "C:\Users\User\AppData\Local\Programs\Python\Python36\Lib\site-packages\webview\lib\WebBrowserInterop.x86.dll;./" --add-data "res;./res/"

In the code i am starting remi some thing like this

if __name__ == "__main__":
    start(NetworkTester, standalone=True,
          width=300, height=300, resizable=False, title='Network Tester')

However when i open the program in windows 7 its just keep refreshing and its just unusable. I cannot type or click button it just keep flicking / refreshing? Any suggestions?

dddomodossola commented 5 years ago

Try using it with standalone=False. Let me know if the problem disappear .

FaizRasool commented 5 years ago

Hi yes - when i open in the IE 11 it has the same problem.

It's giving me InvalidStateError. On Line: 123, Column : 25

Which is javascript code:

if(pendingSendMessages.length<1000){ ws.send(message); }

which is under the function called sendCallbackParam

dddomodossola commented 5 years ago

@FaizRasool try the same with a most modern browser (Firefox or Chrome) . Your browser seems to not support (or not completely) websockets.

FaizRasool commented 5 years ago

Also for some reason i am unable to start pywebview in cef so i have to do this to support older os

# start for windows
def start_browser_legacy_windows():
    start(NetworkTester, title='Network Tester', port=8023, start_browser=False, update_interval=999)

def start_legacy_windows():
    from threading import Thread, Lock
    import sys
    from cefpython3 import cefpython as cef  # import the cef python
    server_lock = Lock()
    browser_thread = Thread(target=start_browser_legacy_windows)
    browser_thread.daemon = True
    browser_thread.start()
    sys.excepthook = cef.ExceptHook  # To shutdown all CEF processes on error
    cef.Initialize()
    windowInfo = cef.WindowInfo()
    windowInfo.SetAsChild(0, [0, 0, 300, 300])
    pb = cef.CreateBrowserSync(windowInfo=windowInfo, browserSettings={}, navigateUrl='http://127.0.0.1:8023',
                               window_title='Network Tester')
    cef.MessageLoop()
    cef.Shutdown()

# starts the web server
if __name__ == "__main__":
    if "Windows-7" in system_info.get():
        start_legacy_windows()
    else:
        start(NetworkTester, standalone=True,
              width=300, height=300, resizable=False, title='Network Tester')
dddomodossola commented 5 years ago

pywebview is based on different libraries. You might update Qt libraries and pywin32 . Does it works with standalone=False and Chrome?