ronaldoussoren / py2app

py2app is a Python setuptools command which will allow you to make standalone Mac OS X application bundles and plugins from Python scripts.
Other
354 stars 35 forks source link

how to edit the "About"-section of my app made with py2app? #310

Open micheld93 opened 4 years ago

micheld93 commented 4 years ago

Hi,

I like almost all Mac apps, my app I've made with py2app has this "About"-Section where the year and the credits are shown normally. Is there a chance to edit this for apps created with py2app?

Example: I made an app with a Tkinter GUI. When I go to the "About"-Section I get the credits of Tkinter, which is bad for sharing the app I've made.

Wishes

Deuchnord commented 3 years ago

The About section of your app is actually handled by your application itself. You can change it by creating an "Help/About" menu and handle it like you would if you were on Windows or Linux. macOS will automatically do some magic and move it to the app name menu.

micheld93 commented 3 years ago

Ok, thanks a lot.

schriftgestalt commented 3 years ago

You can put a file "Credits.html" or "Credits.rtf" in your Resource folder and it will be shown in the About box. It you don’t like the style, you build your own panel.

micheld93 commented 3 years ago

Thanks George. This will be shown in the box automatically or do I need to specify it elsewhere? My experience was, that even with a menu called "About" it doesn't do the mentioned magic. I still get the tk credits, not my. Is there example code for this About-Menu/MacOS problem?

Am Mi., 2. Dez. 2020 um 14:57 Uhr schrieb Georg Seifert < notifications@github.com>:

You can put a file "Credits.html" or "Credits.rtf" in your Resource folder and it will be shown in the About box. It you don’t like the style, you build your own panel.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ronaldoussoren/py2app/issues/310#issuecomment-737245821, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4EPPQWIIIEOBZ7KE6MXUTSSZBVTANCNFSM4RYAEO2Q .

ronaldoussoren commented 3 years ago

The "AppName->About AppName" menu is a special menu. Py2app doesn't create that for you.

AFAIK creating the Credits file in the Resource folder, as described by @schriftgestalt should just work.

Otherwise you can create a custom about box by binding to the "tlkAboutDialog" command and creating the about box in that callback function.

This is how IDLE does that:

root = tkinter.Tk()
...
root.createcommand('tkAboutDialog', about_dialog)

("about_dialog" is function that creates and shows the IDLE about box).

hasii2011 commented 3 years ago

Does this only work for tkinter app. I put a Credits.rtf in my Resource directory and nothing happened. I have a wxPython app

ronaldoussoren commented 3 years ago

See https://wiki.wxpython.org/Optimizing%20for%20Mac%20OS%20X for wxPython (I have no idea if that page is up-to-date).

hasii2011 commented 3 years ago

I see what the key is here; You have to use the built-in ID_ABOUT identifier; Once I do that then the magic happens

self.Bind(wx.EVT_MENU, self.on_about_request, id=wx.ID_ABOUT)
schriftgestalt commented 3 years ago

Just for reference I’m using a .xib for the menu and window. The About menu is set up to call - (void)orderFrontStandardAboutPanel:(id)sender; on NSApplication.

Deuchnord commented 3 years ago

I see what the key is here; You have to use the built-in ID_ABOUT identifier; Once I do that then the magic happens

self.Bind(wx.EVT_MENU, self.on_about_request, id=wx.ID_ABOUT)

My apologies, I didn't make the correlation between the wx.ID_ABOUT and the magic I thought came from macOS. 🙏

hasii2011 commented 3 years ago

BTW using wx.ID_EXIT on your File --> Exit handler will also magically move the quit/exit menu item to the OS X application menu

Screen Shot 2020-12-22 at 10 18 00 AM

AD0T-dev commented 3 years ago

but when you click it Its doesn't show the thing you want

AD0T-dev commented 3 years ago

It shows tkinter one