Hello Helpers,
i installed kivy and the dependencies from kivy.org with pip
when i try to run a simple app
import kivy
from kivy.app import App
from kivy.uix.label import Label
class MyApp(App):
def build(self):
return Label(text="Hello world!!")
if _name__ == '__main__':
MyApp().run()
it shows this error >>
ValueError: kivy._event.EventDispatcher size changed, may indicate binary incompatibility. Expected 40 from C header, got 36 from PyObject
any help Please
UPDATE
SOLUTION
I was using Python V3.8.3 32bit i installed 3.9.2 64bit and reinstall kivy again then it works, that was my solution, i think the issue is in the 32bit version and kivy only runs on 64bit (i just think so), i hope that helps others.
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'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.
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
my python application looks like:
test.py
from PyQt4 import QtCore
from PyQt4 import QtGui
from PyQt4 import QtSql
import sys
import atexit
if __name__ == "__main__":
app = QtGui.QApplication(sys.argv)
db = QtSql.QSqlDatabase.addDatabase('QODBC')
sys.exit(app.exec_())
If i run this application, everything works fine. However, if I create an executable with cx_freeze, I always get the following error:
QSqlDatabase: QODBC driver not loaded
QSqlDatabase: available drivers:
I use the following command to create the executable:
C:\Python27\Scripts\cxfreeze.bat test.py --target-dir C:\Test --include-path="C:\Python27\Lib\site-packages\PyQt4"
If I look into C:\Test (the location where cx_freeze created the executable), I see a bunch of *.dll files with the word 'sql' in it (qsqlodbc4.dll, QtSql4.dll...)
In the past, I created a few PyQT applications with cx_freeze and it always worked really well. However together with the QtSql module, I always get the error message above.
My operating system: Windows 7
Do you guys have any ideas on how to resolve the problem?
edit: Okay, I got it. I copied the contents of PyQt4\plugins\sqldrivers to C:\Test\sqldrivers and now it works.
Kind Regards
Bernhard
This woks only in your developer machine, but when you create a exe file and run this file in other machine it didn't work.
I use pyinstaller, and solve the problem.
only use:
pyinstaller --onefile --windowed myscript.py