This library is pretty incredible for several reasons:
1. It's Python. Nice, simple python baby. This includes all the imports ever, most importantly for me, game imports!
2. Cross-platform. Kivy deploys to many platforms, including Windows, Mac, iOS, and Android.
3. Gui-centric. The library seems to have been created with a gui in mind, and has a kivy file that defines buttons, images, etc.
It's a pretty easy library to get into, so give it a shot!
Learn Python
Download Kivy
Kivy Hello World
Kivy Pong Tutorial
Dive into the docs
If you use eclipse/pydev for your work, here's some good instructions to set up kivy.
Here are a few tips that I found useful:
- Kivy apps are a combination of two files: Python backends for the code and logic, Kivy files that define the layout. However, you can mix everything into one python file and no kivy files.
- Use a different .kv file for your module with the builder
#second_widget.py
from kivy.lang import Builder
from kivy.uix.widget import Widget
# This widget uses SecondWidget.kv
Builder.load_file('SecondWidget.kv')
class SecondWidget(Widget):
pass
- Plan on making a mobile app with lots of python files? Put your main.py class in the base directory, and the rest of the code in a package. It's cleaner, and avoids any wierd headaques with how the file is accessed, and is super easy to shove into the kivy android development app.
Project_Wee/
|-- __init__.py
|-- main.py
|-- WeeCode
|-- __init.py__
|-- second_module.py
|-- SecondModuleWidget.kv
- Did I mention the kivy dev app on android? No building required, just copy-past python files and run it.
- Use kivy properties to link text, objects, and numbers from the gui to your code (and modify them, of course)
No comments:
Post a Comment