perryhuynh / kcauto

kcauto, the successor to kancolle-auto, a Kantai Collection (Kancolle) bot/automation tool
GNU General Public License v3.0
68 stars 22 forks source link

kcauto does not start on macOS #401

Open cplusx opened 4 years ago

cplusx commented 4 years ago

Is the issue consistent (can be reproduced consistently) or is it intermittent (only happens sometimes)?: Yes

Please provide a thorough description of the issue. Screenshots, videos, or at least a step-by-step description of what is happening in the game is typically necessary to debug. line self.tk.call(_flatten((self._w, cmd)) + self._options(cnf)) pops error _tkinter.TclError: unknown option "-relief". My python is 3.7.5, tkinter version 3.6.8

Log

python3 kcauto -cli
[2019-12-02 21:08:31] Initializing kcauto vv8.0.0-rc1 GUI.
[2019-12-02 21:08:31] Starting kcauto GUI.
Traceback (most recent call last):
  File "/Users/jiaxincheng/anaconda3/envs/kcauto/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/Users/jiaxincheng/anaconda3/envs/kcauto/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "kcauto/__main__.py", line 29, in <module>
    gui_main()
  File "kcauto/kcauto_gui.py", line 59, in gui_main
    update_gui(window, event, values)
  File "kcauto/kcauto_gui.py", line 173, in update_gui
    LayoutBase.update_widgets(window)
  File "kcauto/gui/layout_base.py", line 181, in update_widgets
    window[element].Widget.configure(relief='flat')
  File "/Users/jiaxincheng/anaconda3/envs/kcauto/lib/python3.7/tkinter/__init__.py", line 1485, in configure
    return self._configure('configure', cnf, kw)
  File "/Users/jiaxincheng/anaconda3/envs/kcauto/lib/python3.7/tkinter/__init__.py", line 1476, in _configure
    self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
_tkinter.TclError: unknown option "-relief"
perryhuynh commented 4 years ago

Likely due to You are running on OSX, and that OS has strict guidelines for the appearance of buttons. You can't change the relief on buttons on OSX.

Source: https://stackoverflow.com/a/45035271

mrmin123 commented 4 years ago

kcauto is largely untested on OSX. That said, for your current issue you can remove the two lines here:

https://github.com/mrmin123/kcauto/blob/master/kcauto/gui/layout_base.py#L180-L181

and run it again.

cplusx commented 4 years ago

The relief issue is solved, but got another tkinter error _tkinter.TclError: unknown option "-fg" Do you have any idea about which file should I locate? I searched for keyword, there is no explicit assignment of fg=xxx

perryhuynh commented 4 years ago

the CLI should run without issues, the flag is --cli you were missing a -

as for the -fg option, theres multiple usages of it in config_tab_buttons.py and gui_tab_buttons.py

In order to get it running on OSX you may need to also install pyobjc

PySimpleGUI commented 4 years ago

Note that PySimpleGUI Buttons recently changed for the Mac. They are no longer tk.Button but instead ttk.Button. You can force them to be either one but for the Mac the default is ttk buttons. If using the .Widget extension of PySimpleGUI then you'll likely run into problems if originally used the settings using tk.Button parameters.