I'm trying to import .so files in python kivy, which works successfully when ran in Ubuntu but when I package to an apk and try to run it in Android phone, it loads the presplash then exits the app.
Below is the code on test.py
import kivy
from kivy.app import App
from kivy.uix.button import Button
class ButtonApp(App):
def build(self):
btn = Button(text ="hello world")
return btn
def runM():
root = ButtonApp()
root.run()
So I converted the above file(test.py) to test.so file using cython then made a main.py file which calls the runM function
Below is main.py
import test
test.runM()
Problem comes after packaging to apk, before that, everything is working just fine. In my buildozer.spec, source.include_exts I included so extension.
What I'm I missing?
Would appreciate assistance.
Related
Python: 3.11.1
kivy: 2.1.0
Im new coding, and im trying to code with kivy using python, but im getting this error:
sdl2 - ImportError: DLL load failed while importing _window_sdl2
i've tried almost every tutorial but no progres made, don't know what to do, this is the code
import kivy
kivy.require("1.0.6")
from kivy.app import App
from kivy.uix.label import Label
class MyApp(App):
def build(App):
return Label(text="Hello World")
if name == "main":
MyApp().run()
i tried fixing it using every tutorial i could find
I have created and built a basic Hello World kivy app yesterday in Google Colab and build the apk using buildozer and the apk size was above 15.7 MB! Is it normal with the kivy apps or can I compress the app?
The code:
from kivymd.app import MDApp
from kivymd.uix.label import MDLabel
class Main_App(MDApp):
def build(self):
return MDLabel(text="Hello World", halign="center")
if __name__ == "__main__":
Main_App().run()
The required in spec file:
kivy, kivymd, pillow
I keep getting errors when I use python installers (my primary installer contains various libraries such as QSci and other libraries that are part of PyQt5). For example, when I try to convert a simple project with the code below to an executable, it errors out saying ModuleNotFoundError: No module named 'PyQt5.QtPrintSupport'. The projects do compile and run well though. I wonder what is wrong? Thank you in advance!
import sys
import os
import PyQt5
from PyQt5 import QtWidgets, Qsci
from PyQt5 import QtPrintSupport
app = QtWidgets.QApplication(sys.argv)
editor = Qsci.QsciScintilla()
lexer = Qsci.QsciLexerPython(editor)
editor.setLexer(lexer)
## setup autocompletion
api = Qsci.QsciAPIs(lexer)
# import the desired api file
pyqt_path = os.path.dirname(PyQt5.__file__)
api.load(os.path.join(pyqt_path, "Qt/qsci/api/python/Python-3.6.api"))
api.prepare()
editor.setAutoCompletionThreshold(1)
editor.setAutoCompletionSource(Qsci.QsciScintilla.AcsAll)
editor.show()
editor.setText(open(sys.argv[0]).read())
sys.exit(app.exec_())
I'm new to kivy and I recently downloaded it to make apps. But whenever I type the following code in my text editor:
import kivy
from kivy.app import App
from kiv.uix.label import Label
class MyApp(App):
def build(self):
return Label(text="Heyo")
if __name__ == "__main__":
MyApp().run()
I get the following error:
No module named "kivy.app"; kivy is not a package
how do I fix this?
It may be that your 'kivy' installation is in venv or outside of where you're trying to call it. Unless you haven't installed it as previously mentioned.
I'm new to Python and Kivy and am having some trouble getting started. When I run the application I only get a black screen. Advice? :)
import kivy
kivy.require('1.11.0')
from kivy.app import App
from kivy.uix.label import Label
class MyApp(App):
def build(self):
return Label(text = "Tupac is still alive")
if __name__ == "__main__":
MyApp().run()
Running with Python 3.7 and Kivy 1.11.0
It works on my systems. All I did was to add:
#!/usr/bin/env python3
as the first line of your source. And it worked.
I am running Ubuntu 18.04, with Python 3.6.8, and kivy 1.11.1 in a virtual environment. Hope this helps