pywebview
pywebview copied to clipboard
suggestion: Frameless Resize function (native). with demo.
demo was recorded on 4k with 300% zoom

from ctypes import windll, Structure, c_long, byref
class POINT(Structure):
_fields_ = [("x", c_long), ("y", c_long)]
### Get mouse X Y
def queryMousePosition():
pt = POINT()
windll.user32.GetCursorPos(byref(pt))
return { "x": pt.x, "y": pt.y}
### calc window pos , size , mouse pos, mouse movement
def doresize(window):
state_left = windll.user32.GetKeyState(0x01) # Left button down = 0 or 1. Button up = -127 or -128
winWbefore=window.width
winHbefore=window.height
mouseactive=queryMousePosition()
beforex= mouseactive['x']
beforey=mouseactive['y']
while True:
a = windll.user32.GetKeyState(0x01)
if a != state_left: # Button state changed
state_left = a
print(a)
if a < 0:
print('Left Button Pressed')
break
else:
print('Left Button Released')
break
mouseactive=queryMousePosition()
afterx= mouseactive['x']
aftery=mouseactive['y']
try:
totalx=int(beforex)-int(afterx)
totaly=int(beforey)-int(aftery)
except:
print('fail')
if totalx > 0:
changerx=winWbefore+(totalx*-1)
else:
changerx=winWbefore+(totalx*-1)
if totaly > 0:
changerY=winHbefore+(totaly*-1)
else:
changerY=winHbefore+(totaly*-1)
window.resize(changerx, changerY)
time.sleep(0.01)
I am not sure about this. Frameless windows are not resizable by default in Windows if I am not mistaken. Is this feature needed?
if the Developer want to build custom app header (under Frameless=True) he will lose the ability to resize the target window. its a mini solution to provide resize handler for them. (while staying on native libs)
you will see the issue on all apps with webview and frameless.
not sure how much it is needed because i have no idea how many people use "Frameless" but if they do that's the way to resize :D
by the way. thank you for the amazing job you did on the project mate.
Demo custom app header handler

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
The message to post on the issue when closing it. If none provided, will not comment when closing an issue.
Thank you @DizzyduckAR for the solution :) Can plz help me with how to implement it?
Thank you @DizzyduckAR for the solution :) Can plz help me with how to implement it?
I need help how to implement it too!!