I've entered this code in Pyscripter:
import kivy
kivy.require('1.7.2')
from kivy.app import App
from kivy.uix.label import Label
class MyApp(App):
def build(self):
return Label(text='Hello Kivy')
MyApp().run()
I then press the Run button (the green triangle). I get the following error:
Import error: No module named kivy
What can I do to make this work?
P.S. I know I can leave Pyscripter and use kivy.bat, but I would like to use the debugging capabilities within Pyscripter.
I've had the same trouble and I solved it out using a pyscripter's option in the 'Tools' menu called 'Edit Startup scripts' which's name says it all.
Everything you write there should be executed whenever pyscripter starts a python interpreter so it can be used among other things to do the same as 'kivy.bat' but inside pyscripter, I wrote the following startup script basing on info from here How to develop and run kivy apps on PyDev and it works fine for me.
Just change the kivy_path variable in the script so it fixes with the kivy package's path (folder containing kivy.bat) on your computer and you should be able to run your kivy apps just like when you open them with kiby.bat
I think this is probably because kivy.bat really sets up and uses a second python distribution that has kivy installed. However, pyscripter is using your normal system installation, which does not have the kivy module installed.
You can probably tell pyscripter to use the kivy interpreter with the right environment set up. I don't know how exactly (I haven't ever tried on windows), but for instance this previous question is similar but about pycharm rather than pyscripter. I have pasted the answer below, some of it relates specifically to pycharm but something similar will probably work for pyscripter.
You can also try to install kivy in your existing python installation. The kivy website has instructions for this here. I haven't tried this, and there may be some tricky bits.