Here are a few macos specific fixes.
The problem you are having is you need to set the location of the config file. Add the code below to your App class. This will change the location of the config file on MacOS. You can change this to a different location if you prefer.
def get_application_config(self, defaultpath='%(appdir)s/%(appname)s.ini'): if platform == 'macosx': # mac will not write into app folder s = '~/.%(appname)s.ini' else: s = defaultpath return super().get_application_config(defaultpath=s)
Here are a few other Mac specific fixes…
The Mac uses higher resolutions icons that Windows. I create a file called configstartup.py. This file is imported into main.py before kivy.app.App is imported. I also use this to preserve the Window size between runs. This repository shows how to maintain Window size: https://github.com/ElliotGarbus/KivyWindowSize
from configparser import ConfigParserfrom kivy.config import Configfrom kivy.utils import platform """configstartup.py is used to set graphics This code must be at the top of the 'main' executable file. Config.set('graphics'...) are used to set the size of the main window.Win10 requires the windows size to be set prior to App being loaded, to draw smoothly """# Default window size and position, also used to set minimum window sizewindow_width = 1000window_height = 650window_top = 50window_left = 100 if platform != 'macosx': import os ini_file = os.path.join(os.getcwd(), 'your_configfile.ini') # Use Python lib configparser to read .ini file prior to app startup parser = ConfigParser() found = parser.read(ini_file) # created in main.py: build_config() if found: Config.set('graphics', 'width', parser['Window']['width']) Config.set('graphics', 'height', parser['Window']['height']) Config.set('graphics', 'position', 'custom') Config.set('graphics', 'top', parser['Window']['top']) # find top and left Config.set('graphics', 'left', parser['Window']['left']) else: Config.set('graphics', 'width', window_width) # default value match default values in main.py: build_config, on_start Config.set('graphics', 'height', window_height) Config.set('graphics', 'position', 'custom') Config.set('graphics', 'top', window_top) Config.set('graphics', 'left', window_left)if platform == 'macosx': Config.set('kivy', 'window_icon','Images/surgeon_app_logo_512.png')else:Config.set('kivy', 'window_icon','Images/surgeon_app_logo_64.png') # Windows uses a small png
Config.set('kivy', 'exit_on_escape', 0)Config.set('input', 'mouse', 'mouse,disable_multitouch')#Config.set('kivy', 'log_level', 'error')
For reference here is my mac specfile:
# -*- mode: python -*- block_cipher = Noneapp_name = 'MyApp Name Here'mac_icon = '../Images/logo_512.icns' a = Analysis(['../main.py'], pathex=[], binaries=[], datas=[('../*.kv', '.'), ('../Images/*.png', './Images')], hiddenimports=[], hookspath=[], runtime_hooks=[], excludes=['_tkinter', 'Tkinter', 'enchant', 'twisted'], win_no_prefer_redirects=False, win_private_assemblies=False, cipher=block_cipher, noarchive=False) pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) exe = EXE(pyz, a.scripts, [], exclude_binaries=True, name=app_name, debug=False, bootloader_ignore_signals=False, strip=False, upx=False, console=False) coll = COLLECT(exe, a.binaries, a.zipfiles, a.datas, strip=False, upx=False, name=app_name) app = BUNDLE(coll, name=app_name + '.app', icon=mac_icon, bundle_identifier=None)--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/dd363559-5a62-4cc1-92b3-b25cef17399cn%40googlegroups.com.