Python-Easy-Chess-GUI icon indicating copy to clipboard operation
Python-Easy-Chess-GUI copied to clipboard

install new engine causes a crash

Open thanakijwanavit opened this issue 4 years ago • 3 comments

System information

Macbook Air with M1 16GB
OS: OSX 11.0.1 Big Sur
Python: Python 3.9.1
packages:
  python-chess:  1.999
  pysimplegui: 4.32.1
  pyperclip: 1.8.1

i clicked menu>engine>manage>install

Traceback (most recent call last):
  File "/Users/nic/chess/Python-Easy-Chess-GUI/python_easy_chess_gui.py", line 3575, in <module>
    main()
  File "/Users/nic/chess/Python-Easy-Chess-GUI/python_easy_chess_gui.py", line 3571, in main
    pecg.main_loop()
  File "/Users/nic/chess/Python-Easy-Chess-GUI/python_easy_chess_gui.py", line 2859, in main_loop
    window.Disable()
  File "/Users/nic/miniforge3/envs/python39/lib/python3.9/site-packages/PySimpleGUI/PySimpleGUI.py", line 8537, in Disable
    self.TKroot.attributes('-disabled', 1)
  File "/Users/nic/miniforge3/envs/python39/lib/python3.9/tkinter/__init__.py", line 1968, in wm_attributes
    return self.tk.call(args)
_tkinter.TclError: bad attribute "-disabled": must be -alpha, -fullscreen, -modified, -notify, -titlepath, -topmost, -transparent, or -type

thanakijwanavit avatar Dec 12 '20 16:12 thanakijwanavit

Thanks for the info. It seems related to this issue #36 and #35.

I need to examine what happened to the PySimpleGUI framework.

fsmosca avatar Dec 13 '20 04:12 fsmosca

If you want to experiment modify the pysimplegui.py source with the following.

    def disable(self):
        """
        Disables window from taking any input from the user
        """
        if not self._is_window_created():
            return
        self.TKroot.grab_release()  # Only 'disables' an already 'enabled' window. Does nothing to a normal window
        # self.TKroot.attributes('-disabled', 1)
        # self.TKroot.grab_set_global()

    def enable(self):
        """
        Re-enables window to take user input after having it be Disabled previously
        """
        if not self._is_window_created():
            return
        self.TKroot.grab_set  # I read grab_set_global messes with all open windows so I wanted to avoid that
        # self.TKroot.attributes('-disabled', 0)
        # self.TKroot.grab_release()

This works on windows 10, and linux, perhaps it will work too in osx.

fsmosca avatar Apr 21 '21 15:04 fsmosca

If you want to experiment modify the pysimplegui.py source with the following.

    def disable(self):
        """
        Disables window from taking any input from the user
        """
        if not self._is_window_created():
            return
        self.TKroot.grab_release()  # Only 'disables' an already 'enabled' window. Does nothing to a normal window
        # self.TKroot.attributes('-disabled', 1)
        # self.TKroot.grab_set_global()

    def enable(self):
        """
        Re-enables window to take user input after having it be Disabled previously
        """
        if not self._is_window_created():
            return
        self.TKroot.grab_set  # I read grab_set_global messes with all open windows so I wanted to avoid that
        # self.TKroot.attributes('-disabled', 0)
        # self.TKroot.grab_release()

This works on windows 10, and linux, perhaps it will work too in osx.

on mac osx and that worked for me ... thanks @fsmosca

JasonL888 avatar Feb 04 '22 03:02 JasonL888

There is a new commit at 41a4ae236dc0c8ba0644b8eb7cde7ad55acf8977 to try to fix this issue.

Windows: ok Linux/Ubuntu: ok mac: not tested

fsmosca avatar Dec 01 '22 16:12 fsmosca