What you’re seeing is:
Why it happens On macOS, the underlying Cocoa implementation of pywebview sometimes renders the title as part of the window content as well as in the titlebar, due to the way the NSWindow/NSView components are integrated if not all window management is handled natively by your code.
Proposed fix :
Do not set the title using create_window
, and set it afterwards
For example :
import webview
def set_my_title(window):
# window refers to the window object you created
window.set_title("blah")
window = webview.create_window(
"", # empty title set for the webpage
f"http://localhost:{port}",
width=1400,
height=900,
min_size=(800, 600),
on_top=False
)
webview.start(set_my_title, window) # set title here