r0x0r / pywebview

Build GUI for your Python program with JavaScript, HTML, and CSS
https://pywebview.flowrl.com
BSD 3-Clause "New" or "Revised" License
4.62k stars 537 forks source link

Using windll.gdi32.CreateRoundRectRgn to set round corner makes the window have a white frame #1413

Closed mimi99528 closed 1 month ago

mimi99528 commented 2 months ago

Specification

Description

......

定义一些Windows API函数和常量

user32 = windll.user32 gdi32 = windll.gdi32

def set_window_region(hwnd, radius): rect = win32gui.GetWindowRect(hwnd) width = rect[2] - rect[0] height = rect[3] - rect[1] hRgn = windll.gdi32.CreateRoundRectRgn(0, 0, width + 1, height + 1, radius, radius) if hRgn != 0: windll.user32.SetWindowRgn(hwnd, hRgn, True) windll.gdi32.DeleteObject(hRgn)

......

if name == 'main': api = API() window = webview.create_window('JS API example', html=custom_titlebar_html, js_api=api, frameless=True, background_color='#000000')

time.sleep(1)

webview.start(func=on_window_loaded)

The code makes the window have a white frame, like below:

{~UMBAY%QX(O}LD{@MJ{D4C

Practicalities

r0x0r commented 2 months ago

You can probably hide the window border in a similar manner using win32.

github-actions[bot] commented 1 month ago

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.

github-actions[bot] commented 1 month ago

The message to post on the issue when closing it. If none provided, will not comment when closing an issue.