Kivy packaging to .exe (standalone, onefile)

27 views
Skip to first unread message

Pht Jaengarun

unread,
Nov 6, 2018, 5:57:07 AM11/6/18
to Kivy users support
I already compile the .spec file and got an icon of the program but it didn't work ( I used python 3.7 and kivy 1.10.1 on windows 7)
I already add:

def resourcePath():
'''Returns path containing content - either locally or in pyinstaller tmp file'''
if hasattr(sys, '_MEIPASS'):
# print(os.path.join(sys._MEIPASS))
return os.path.join(sys._MEIPASS)

return os.path.join(os.path.abspath("."))
and
if __name__ == '__main__':
kivy.resources.resource_add_path(resourcePath()) # add this line
V().run()

here are my .spec file:

# -*- mode: python -*-
from kivy.deps import sdl2, glew
block_cipher = None


a = Analysis(['D:\V\EditScriptGUI.py'],
pathex=None,
binaries=None,
datas=None,
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)

pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)

a.datas += [('XXXtools.kv', '../../FP/XXXtools.kv', 'DATA')]


added_files = [( 'XXXtools.kv', '.' )]
exe = EXE(pyz, Tree('D:\\V\\'),
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
*[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
name='V',
debug=False,
strip=False,
upx=True,
console=False, icon='D:\\V\\orange.ico' )

screen_kivyapp.png
Reply all
Reply to author
Forward
0 new messages