Search code examples
pythonhtmleel

Unable to use both size of the window and application options together with Eel


I have tried to write a simple application to check how Eel works (I am new to Eel) and did some customization for application options and requested for a specific size. The Python code looks like below:

    import eel
    app_options = {
        'mode': "chrome",
        'host': "localhost",
        'port': 0
    } #'mode' as 'chrome-app' also has same issue
    eel.init('web')
    eel.start('main.html', size=(600,600), options=app_options)

For the above Python code with the below main.html file I am unable to see the window getting sized as per my requirement. If I remove the 'options' parameter from the 'start' method then the size of the application is as specified. So, when both 'size' and 'options' params are given only 'options' is being honoured. How can I make sure that both size and options work as specified?

Below is the main.html

<html>
    <head>
        <title>Test Eel page</title>
        <script type="text/javascript" src="eel.js"></script>
    </head>
    <body>
        <p>Hello World</p>
    </body>
</html>


Python version: 3.7.2
Eel version: 0.10.4
Chrome version: 73.0.3683.75 (Official Build) (64-bit)


Solution

  • We can use predefined functions in eel to get force chrome-app mode and set size.

    if eel.chrome.get_instance_path() is not None:
        eel.start('main.html', size=(650, 612), options={'port': 0})
    else:
        eel.start('main.html', size=(650, 612), options={
                  'port': 0, 'mode': 'user selection'})