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

Different menus for different windows? #1414

Closed SublunarSage closed 6 days ago

SublunarSage commented 2 months ago

Specification

Description

Good evening! I recently discovered your library and am very much enjoying using it so far, but I had a question regarding its functionality: is it possible to have different menus for different windows (I.E, one window could have 3 different menu items, another window could have 1 menu item, and a third window could no menu), or is that not implemented yet? I ask because I want to see whether or not it's possible to do in the program first before doing a more manual solution using frameless windows.

Thank you for your assistance!

Practicalities

r0x0r commented 2 months ago

Window specific menus have never been done, but it should be added. The api could be the same with an exception that menu would be given to create_window instead of start. If both are supplied, window specific menu would overwrite the global menu. Feel free to work on this.

SublunarSage commented 2 months ago

Hi there! Thanks for the super quick response. I'll be honest and say that I'm still pretty new to programming, so after looking through the code on adding different menus to different windows, I'm honestly not sure where to start. ^^; I know it's rather frustrating to have someone say they'll do something but then doesn't, but if it's any consolation, I could try and see if I could provide some monetary funds to see this feature be added.

garyganyang commented 2 months ago

i got a way to do so. use the following to create your second window, it works

webview.guilib.set_app_menu([]) window2 = webview.create_window( '关于', url=url, easy_drag=False, width=400, height=300)

cjb1234567 commented 1 month ago

i got a way to do so. use the following to create your second window, it works

webview.guilib.set_app_menu([]) window2 = webview.create_window( '关于', url=url, easy_drag=False, width=400, height=300)

Niu bi!

github-actions[bot] commented 1 week 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 6 days ago

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