0

I am trying to show a local html page in pywebview in a maximized screen by default , I have tried all methods I could find but it didnt work. here is my code :

from flask import Flask, send_from_directory
import threading
import webview
import os
 
...

webview.create_window('My React App', url='http://127.0.0.1:5000')
webview.start()

here is what I have tried so far:

  1. I tried Fullscreen flag as True but it will only show the webview in full screen and the windows frame around the webview disappears, I am trying to show it as a maximized window with "close , minimize etc" buttons

    webview.create_window('My React App', url='http://127.0.0.1:5000', fullscreen=True)

  2. Then I tried to get the screen size and define that as height and width , it maximized the window but it showed 10 pixel gap on the right and left side of the window :

    screen_width = user32.GetSystemMetrics(0)
    screen_height = user32.GetSystemMetrics(1)
    
    root.geometry(f"{screen_width}x{screen_height}")
    
    
    webview.create_window("My React App",url="http://127.0.0.1:5000",width=screen_width, height=screen_height)
    
    
    

How can I make it so , that it launched the webview in a maximized window by default?

Arad
  • 1
  • 3

1 Answers1

0

In webview, maximize functionality is not available by default.

You can try fullscreen option of the webview.create_window() method.

from flask import Flask, send_from_directory
import threading
import webview
import os
 
...

webview.create_window('My React App', url='http://127.0.0.1:5000', fullscreen=True)
webview.start()