package kivy app, pyinstaller

61 views
Skip to first unread message

nataliyah ahmad

unread,
Oct 11, 2022, 1:31:40 AM10/11/22
to Kivy users support
hi

I would like to know what are the changes that are required to be made to " .spec" file, when we package the app using pyinstaller. if the path is something like 
C:\Users\username\webd\kivy-android\deploy and the folder contains the files in the image.
how can I add the support for opengl 1.x while packaging the app using the following solution. 

 
or 


folderfiles.png

Elliot Garbus

unread,
Oct 11, 2022, 5:38:29 PM10/11/22
to kivy-...@googlegroups.com

 

To build a Windows app you can use a spec file like on this project:

https://github.com/ElliotGarbus/BackingTrackPlayer

 

Notice the spec file is in a subdirectory of the project. https://github.com/ElliotGarbus/BackingTrackPlayer/blob/master/BackingTrackPlayerDist/w10.spec

The datas section is used to bring in data files.  It is used here to bring in .png files.  You would also add your kv files to the datas section.   In this app I am using ffmpeg.exe as an executable that gets called from pythyon.  I included ffmpeg.exe here to include the executable into the bundle that pyinstaller creates.  I have not taken a look at the links you included about opengl but if there is an exe to include, you would include it the same way.

 

For info on datas read:  https://pyinstaller.org/en/stable/spec-files.html#adding-data-files

 

FWIW I don’t know anything about the code you pointed out to run on older hardware, Kivy targets OpenGL ES2.0.  See: https://kivy.org/doc/stable/guide/architecture.html?highlight=opengl%202%200%20es#graphics  “Kivy’s graphics API is our abstraction of OpenGL. On the lowest level, Kivy issues hardware-accelerated drawing commands using OpenGL. Writing OpenGL code however can be a bit confusing, especially to newcomers. That’s why we provide the graphics API that lets you draw things using simple metaphors that do not exist as such in OpenGL (e.g. Canvas, Rectangle, etc.).

All of our widgets themselves use this graphics API, which is implemented on the C level for performance reasons.

Another advantage of the graphics API is its ability to automatically optimize the drawing commands that your code issues. This is especially helpful if you’re not an expert at tuning OpenGL. This makes your drawing code more efficient in many cases.

You can, of course, still use raw OpenGL commands if you prefer. The version we target is OpenGL 2.0 ES (GLES2) on all devices, so if you want to stay cross-platform compatible, we advise you to only use the GLES2 functions.”

 

 

 

# -*- mode: python -*-
 
from kivy_deps import sdl2, glew
 
block_cipher = None
app_name = 'Backing Track Player'
win_icon = '../icons8_refresh_64_icon.ico'
 
a = Analysis(['../main.py'],   # spec file is in subdirectory of main project
             pathex=[],
             datas=[('../ffmpeg.exe', '.'), ('../*.png', '.')],
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             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,
          icon=win_icon)
coll = COLLECT(exe,
               a.binaries,
               a.zipfiles,
               a.datas,
               *[Tree(p) for p in (sdl2.dep_bins + glew.dep_bins)],
               strip=False,
               upx=False,
               name=app_name)

--
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/69cf6870-7fbe-453e-8642-3d65d1826aa8n%40googlegroups.com.

 

ElliotG

unread,
Oct 11, 2022, 5:48:14 PM10/11/22
to Kivy users support
On a windows machine you could try using the angle backend if Dx9 is supported. (Rather than trying to get an older version of OGL working.) 
see: KIVY_GL_BACKEND

nataliyah ahmad

unread,
Oct 12, 2022, 2:16:47 AM10/12/22
to kivy-...@googlegroups.com
Thanks a lot for the detailed answer. I going to try it out and get back to you. thanks again

Reply all
Reply to author
Forward
0 new messages