1
0
Fork 0
mirror of https://github.com/shlomif/PySolFC.git synced 2025-04-05 00:02:29 -04:00

macOS: use "PySolFC Help" menuitem provided by tk

The details are explained in this tutorial
https://tkdocs.com/tutorial/menus.html

For this to work, init() must destroy the tkinter.Tk instance it creates
so that was uncommented.
This commit is contained in:
Juhani Numminen 2020-10-14 14:59:38 +03:00
parent 7255ad9e68
commit 24ccdf634b
3 changed files with 11 additions and 4 deletions

View file

@ -117,7 +117,7 @@ def init():
else:
pysollib.settings.USE_TILE = True
# "can't invoke event <<ThemeChanged>>: application has been destroyed"
# root.destroy()
root.destroy()
tkinter._default_root = None
# check FreeCell-Solver

View file

@ -646,10 +646,16 @@ class PysolMenubarTkCommon:
if self.progress:
self.progress.update(step=1)
# macOS: tk creates the menu item "Help->PySolFC Help", therefore
# we will not create a duplicate "Help->Contents" item.
# The tk-provided menu item expects this callback.
self.top.createcommand('tk::mac::ShowHelp', self.mHelp)
menu = MfxMenu(self.menubar, label=n_("&Help"))
menu.add_command(
label=n_("&Contents"),
command=self.mHelp, accelerator=m+"F1")
if WIN_SYSTEM != "aqua":
menu.add_command(
label=n_("&Contents"),
command=self.mHelp, accelerator=m+"F1")
menu.add_command(
label=n_("&How to play"),
command=self.mHelpHowToPlay)

View file

@ -112,6 +112,7 @@ def make_help_toplevel(app, title=None):
from pysollib.winsystems import init_root_window
window = tkinter.Toplevel(class_=TITLE)
init_root_window(window, app)
window.tkraise()
return window