Imam Ferianto Blogs

sekedar catatan kecil saja

Kivy adalah sebuah cross platform python framework yang dipergunakan untuk membuat aplikasi yang dapat dijalankan di platform desktop, dan mobile (ios, android). Kivy Menggunakan library SDL, OpenGL dalam core libnya, Kivy didukung oleh Mac, Windows, dan Linux di tataran dekstop. Sedangkan di tataran mobile, Kivy didukung oleh Android dan iOS. Dengan Kivy, Anda tidak perlu khawatir untuk membuat sebuah aplikasi. Dengan menggunakan bahasa pemrograman Python, maka dengan source code yang sama dapat mendistribusikan aplikasi yang kita bangun menggunakan Kivy. Kivy terbaru saat tulisan ini dibuat baru support sampai python 3.7.

Requirement :

##installasi untuk python2 (cara mudah)

brew install pkg-config sdl2 sdl2_image sdl2_ttf sdl2_mixer gstreamer autoconf automake
python -m pip install kivy
python -m pip install ffpyplayer
python -m pip install python-for-android
python -m pip install cython
python -m pip install buildozer
p4a --version

##instalasi dari sourcecode (build kivy)

toolchain build python3 kivy

Contoh kode kivy (coba.py):

from kivy.app import App
from kivy.uix.button import Button

class TestApp(App):
    def build(self):
        return Button(text='Hello World')

TestApp().run()

Compile dengan cython agar jadi single executable:

cython --embed -o coba.c coba.py
gcc `python-config --cflags --ldflags` coba.c -o coba

Jalankan dengan console :  ./coba

Hasil GUI:

Referensi:
https://pypi.org/project/buildozer/
https://id.wikipedia.org/wiki/Python_(bahasa_pemrograman)
https://kivy.org/#home
https://kivy.org/doc/stable-1.10.1/installation/installation.html
https://github.com/kivy/kivy/wiki/Android-native-embedded-browser
https://realpython.com/mobile-app-kivy-python/
https://github.com/kivy/kivy-ios
https://github.com/kivy/python-for-android
https://www.androidauthority.com/an-introduction-to-python-on-android-759685/
https://dbader.org/blog/python-mobile-development-kivy-vs-beeware
https://www.codepolitan.com/membangun-aplikasi-android-dengan-python-kivy-5b61d26882da1
https://towardsdatascience.com/python-for-android-start-building-kivy-cross-platform-applications-6cf867d44612
https://pyzia.com/
https://realpython.com/mobile-app-kivy-python/