mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-15 02:54:09 -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:
parent
7255ad9e68
commit
24ccdf634b
3 changed files with 11 additions and 4 deletions
|
@ -117,7 +117,7 @@ def init():
|
||||||
else:
|
else:
|
||||||
pysollib.settings.USE_TILE = True
|
pysollib.settings.USE_TILE = True
|
||||||
# "can't invoke event <<ThemeChanged>>: application has been destroyed"
|
# "can't invoke event <<ThemeChanged>>: application has been destroyed"
|
||||||
# root.destroy()
|
root.destroy()
|
||||||
tkinter._default_root = None
|
tkinter._default_root = None
|
||||||
|
|
||||||
# check FreeCell-Solver
|
# check FreeCell-Solver
|
||||||
|
|
|
@ -646,10 +646,16 @@ class PysolMenubarTkCommon:
|
||||||
if self.progress:
|
if self.progress:
|
||||||
self.progress.update(step=1)
|
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 = MfxMenu(self.menubar, label=n_("&Help"))
|
||||||
menu.add_command(
|
if WIN_SYSTEM != "aqua":
|
||||||
label=n_("&Contents"),
|
menu.add_command(
|
||||||
command=self.mHelp, accelerator=m+"F1")
|
label=n_("&Contents"),
|
||||||
|
command=self.mHelp, accelerator=m+"F1")
|
||||||
menu.add_command(
|
menu.add_command(
|
||||||
label=n_("&How to play"),
|
label=n_("&How to play"),
|
||||||
command=self.mHelpHowToPlay)
|
command=self.mHelpHowToPlay)
|
||||||
|
|
|
@ -112,6 +112,7 @@ def make_help_toplevel(app, title=None):
|
||||||
from pysollib.winsystems import init_root_window
|
from pysollib.winsystems import init_root_window
|
||||||
window = tkinter.Toplevel(class_=TITLE)
|
window = tkinter.Toplevel(class_=TITLE)
|
||||||
init_root_window(window, app)
|
init_root_window(window, app)
|
||||||
|
window.tkraise()
|
||||||
return window
|
return window
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue