python-eel / Eel

A little Python library for making simple Electron-like HTML/JS GUI apps
MIT License
6.44k stars 587 forks source link

How can I stop user to resizing the eel window size? Or is there any way to lock the window size or freeze the window size? #432

Closed theumangbaraiya closed 3 years ago

theumangbaraiya commented 3 years ago

Currently, I am working on a Python project where I have to make a desktop application using the python EEL library and I have done half of the project.

Recently I found out that I need to freeze my window size. So is there any option or trick so I can freeze my window size or in javascript to stop the user from resizing my window?

What argument could be added to these options?

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)

Any type of help is appreciated.

ChrisKnott commented 3 years ago

In Chrome I think you can only do this with windows you have created. See this SO answer - https://stackoverflow.com/a/10610931

Any solution using Chrome is likely to be quite hacky because forcing a particular view size is considered user-hostile.

theumangbaraiya commented 3 years ago

Thanks, @ChrisKnott for the help but it is not working

JeswinSunsi commented 3 years ago

@RapchikUmang31 This is a workaround that I've made. It's quite hacky but gets the job done.

window.addEventListener("resize", function(){
window.resizeTo({xValue}, {yValue});
});

Add that to all your pages and it should work fine

hi-Nobody commented 3 years ago

Try this way working for me!! Adding the following code in main.html

<script>
  $(document).ready(function (){
      window.resizeTo(600, 600);
  });
</script>
Yanger-Rai commented 2 years ago

I added it to my html page(I have only one). It's not working