简体   繁体   English

如何在用户系统的任何可用浏览器中启动python Eel?

[英]How to start python Eel in any available browser of user system?

I am trying to create a windows based application using eel.我正在尝试使用 eel 创建一个基于 windows 的应用程序。 I want it to start in any available browser in the system of the user.我希望它在用户系统中的任何可用浏览器中启动。 How can I do it?我该怎么做? ( consider that user have not installed chrome in his system ) (考虑到用户没有在他的系统中安装 chrome )

You can pass in mode='default' to the eel.start function, and it will try to open the system's default browser.你可以传入mode='default'eel.start function,它会尝试打开系统默认的浏览器。 Something like this:是这样的:

eel.start('index.html', mode='default')

In this case, behind-the-scenes Eel will be proxying the open request to Python's webbrowser.open function, so it's best to check there if you want to know the logic being used.在这种情况下,幕后的 Eel 会将打开请求代理到 Python 的webbrowser.open function,因此如果您想了解所使用的逻辑,最好检查那里。 Or you can look at the Python source file for webbrowser.py on your machine... on Windows it would be located somewhere like: C:\Python39\Lib\webbrowser.py .或者您可以在您的机器上查看webbrowser.py的 Python 源文件...在 Windows 上,它位于如下位置: C:\Python39\Lib\webbrowser.py

Maybe it's too late for you, I had the same problem.也许对你来说为时已晚,我遇到了同样的问题。 So to resolve it you have open your folder with code source of eel and open init .py and change browser option.因此,要解决它,您需要打开带有 eel 代码源的文件夹,然后打开init .py 并更改浏览器选项。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM