2

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)

Sushant Pachipulusu
  • 5,499
  • 1
  • 18
  • 30

1 Answers1

4

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'})
Agawane
  • 173
  • 1
  • 8
  • 5
    While this code may solve the question, [including an explanation](https://meta.stackexchange.com/questions/114762) of how and why this solves the problem would really help to improve the quality of your post, and probably result in more up-votes. Remember that you are answering the question for readers in the future, not just the person asking now. Please edit your answer to add explanations and give an indication of what limitations and assumptions apply. – Pika Supports Ukraine Jun 03 '19 at 16:23
  • Hi @Agawane the first method of adding chrome flags didn't work for me but the alternate method suggested by you has worked. But I do not understand why the instance path is making a difference here. Can you please explain? Apologies for delayed response. I was held up with some other critical work – Sushant Pachipulusu Jun 10 '19 at 05:50
  • 1
    Sushant, have a look at the functions defined in eel(link below). https://github.com/ChrisKnott/Eel/blob/master/eel/chrome.py – Agawane Jun 10 '19 at 16:27