Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14040

Window after minimize from windows taskbar get bigger and bigger (pywebview)

$
0
0

I'm trying to make a window which wants to be frameless (Is option in pywebview too but I can't minimize from windows taskbar) with custom menu like Spotify (for example) the idea is working succesfully but after minimze from windows taskbar and press on it back actual window is getting bigger mysteriously

import win32conimport win32guiimport webviewimport ctypesdef on_loaded():    print('DOM is ready')    window.show()    window_handle = ctypes.windll.user32.FindWindowW(None, "Test")    current_style = ctypes.windll.user32.GetWindowLongPtrW(window_handle, win32con.GWL_STYLE)    new_style = current_style & ~win32con.WS_CAPTION & ~win32con.WS_SYSMENU & ~win32con.WS_BORDER    new_style |= win32con.WS_POPUP      ctypes.windll.user32.SetWindowLongPtrW(window_handle, win32con.GWL_STYLE, new_style)    ex_style = ctypes.windll.user32.GetWindowLongPtrW(window_handle, win32con.GWL_EXSTYLE)    ctypes.windll.user32.SetWindowLongPtrW(window_handle, win32con.GWL_EXSTYLE, ex_style | 0x80000000)    webview.windows[0].events.loaded -= on_loadeddef on_resized(width, height):    print('pywebview window is resized. new dimensions are {width} x {height}'.format(            width=width, height=height        )    )if __name__ == '__main__':    window = webview.create_window('Test', html='<html><head></head><body><h1>Test application</body></html>', hidden=True    )    window.events.loaded += on_loaded    window.events.resized += on_resized    webview.start()

After running that everything works fine but after minimize from windows taskbar and bring it back it trigger resize event with these messages

pywebview window is resized. new dimensions are 800 x 600pywebview window is resized. new dimensions are 160 x 28pywebview window is resized. new dimensions are 800 x 600pywebview window is resized. new dimensions are 802 x 625pywebview window is resized. new dimensions are 160 x 28pywebview window is resized. new dimensions are 802 x 625pywebview window is resized. new dimensions are 804 x 650pywebview window is resized. new dimensions are 160 x 28

I can resize it with window.resize(800, 600) in resize event but I don't think it's the best fix


Viewing all articles
Browse latest Browse all 14040

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>