SlideShare a Scribd company logo
1 of 14
Introduction
to Kivy
A Cross-Platform Python UI Library
In this Session we shall
discuss:
 How to setup kivy
 Some key features of kivy
 Make a simple ‘Hello World’ application
 Introduce the ‘kv’ language
 Package the application for the android market
Setting up Kivy
3 very simple commands:
1. Add Source
 sudo add-apt-repository ppa:kivy-team/kivy
2. Update
 sudo apt-get update
3. Install Kivy
 sudo apt-get install python-kivy

Basic Components of Kivy
§ App
§ Widget
§ ScreenManger
§ Screen
§ Layouts
§ Button
§ Label
§ TextInput
§ Image
§ Clock
§ SoundLoader
§ Animation
Types of Layouts
§ Anchor Layout
§ Box Layout
§ Float Layout
§ Relative Layout
§ Grid Layout
§ Stack Layout
Hello World
f r o m k i v y . a p p i m p o r t A p p
f r o m k i v y . u i x . f l o a t l a y o u t i m p o r t F l o a t L a y o u t
f r o m k i v y . u i x . b u t t o n i m p o r t B u t t o n
f r o m k i v y . u i x . l a b e l i m p o r t L a b e l
c l a s s M y A p p ( A p p ) :
t i t l e = ' H e l l o W o r l d '
d e f b u i l d ( s e l f ) :
s e l f . a p p w i n d o w = F l o a t L a y o u t ( )
b u t t o n = B u t t o n ( t e x t = ' C l i c k H e r e ' )
b u t t o n . b i n d ( o n _ r e l e a s e = s e l f . b u t t o n p r e s s )
s e l f . a p p w i n d o w . a d d _ w i d g e t ( b u t t o n )
r e t u r n s e l f . a p p w i n d o w
d e f b u t t o n p r e s s ( s e l f , * a r g s ) :
s e l f . a p p w i n d o w . c l e a r _ w i d g e t s ( )
s e l f . a p p w i n d o w . a d d _ w i d g e t ( L a b e l ( t e x t = ' H e l l o W o r l d ! ' ) )
i f _ _ n a m e _ _ = = ' _ _ m a i n _ _ ' :
g l o b a l m y a p p
m y a p p = M y A p p ( )
m y a p p . r u n ( )
The ‘kv’ Language
class MyButton(Button):
def __init__(self,**kwargs):
super(MyButton,self).__init__(**kwargs)
<MyButton>:
size_hint_x: None
size_hint_y: None
In the kv file:
In the python file:
Packaging the app
There are two ways to package the
app:
1. Manually using python-for-android
2.
3. Automatically using buildozer
Prerequisites for manual
packaging:
§ Build-Essential and others:
§ sudo apt-get install build-essential patch git-core ccache ant python-pip python-dev
§ Latest Cython:
§ Pip install –upgrade cython
§ Android SDK
§ http://developer.android.com/sdk/index.html
§ Android NDK
§ http://developer.android.com/sdk/ndk/index.html
§ Environment variables
§ export ANDROIDSDK=/path/to/android-sdk
§ export ANDROIDNDK=/path/to/android-ndk
§ export ANDROIDNDKVER=rX
§ export ANDROIDAPI=X
§ export PATH=$ANDROIDNDK:$ANDROIDSDK/platform-tools:$ANDROIDSDK/tools:
$PATH
§
Manually
§ Get python-for-android:
§ git clone git://github.com/kivy/python-for-android
§ Create distribution:
§ ./distribute.sh -m "kivy"
§ Build apk:
§ cd dist/default
§ ./build.py --dir <path to your app>
--name "<title>"
--package <org.of.your.app>
--version <human version>
--icon <path to an icon to use>
--orientation <landscape|portrait>
--permission <android permission like VIBRATE> (multiple
allowed)
<debug|release>
Automatic Packaging
using buildozer:
§ Get buildozer:
§ git clone https://github.com/kivy/buildozer.git
§ cd buildozer
§ sudo python2.7 setup.py install
§ Create spec file:
§ cd path/to/app
§ buildozer init
§ Build:
§ buildozer android <debug|release>
Signing and Aligning
(Only for Release apk)
§ Generate keystore
§ keytool -genkey -v -keystore
path/to/keystore/name.keystore -alias myalias
-keyalg RSA -keysize 2048 -validity 10000
§ <New Password>
§ Sign using keystore
§ jarsigner -verbose -sigalg SHA1withRSA -digestalg
SHA1 -keystore ./keystores/com-mydomain-
myapp.keystore ./myapp/bin/MyApp-1.0.0-
release-unsigned.apk myalias
§ <keystore password>
§ Zipalign
§ ~/.buildozer/android/platform/android-sdk-
21/tools/zipalign -v 4 ./myapp/bin/MyApp-1.0.0-
release-unsigned.apk ./myapp/bin/MyApp-
1.0.0.apk
All Done!
Congratulations on your first apk!
Thank You!

More Related Content

What's hot

[Android] Multimedia Programming
[Android] Multimedia Programming[Android] Multimedia Programming
[Android] Multimedia ProgrammingNikmesoft Ltd
 
What is Kotlin Multiplaform? Why & How?
What is Kotlin Multiplaform? Why & How? What is Kotlin Multiplaform? Why & How?
What is Kotlin Multiplaform? Why & How? Shady Selim
 
Gstreamer: an Overview
Gstreamer: an OverviewGstreamer: an Overview
Gstreamer: an OverviewRodrigo Costa
 
Introduction to Flutter
Introduction to FlutterIntroduction to Flutter
Introduction to FlutterApoorv Pandey
 
INTRODUCTION TO FLUTTER.pdf
INTRODUCTION TO FLUTTER.pdfINTRODUCTION TO FLUTTER.pdf
INTRODUCTION TO FLUTTER.pdfAdarshMathuri
 
Google flutter the easy and practical way
Google flutter the easy and practical wayGoogle flutter the easy and practical way
Google flutter the easy and practical wayAhmed Abu Eldahab
 
Building beautiful apps with Google flutter
Building beautiful apps with Google flutterBuilding beautiful apps with Google flutter
Building beautiful apps with Google flutterAhmed Abu Eldahab
 
Intro to Flutter SDK
Intro to Flutter SDKIntro to Flutter SDK
Intro to Flutter SDKdigitaljoni
 
Introduction to Vault
Introduction to VaultIntroduction to Vault
Introduction to VaultKnoldus Inc.
 
What is flutter and why should i care?
What is flutter and why should i care?What is flutter and why should i care?
What is flutter and why should i care?Sergi Martínez
 
Introduction to Qt Creator
Introduction to Qt CreatorIntroduction to Qt Creator
Introduction to Qt CreatorQt
 
Using the Presentation API and external screens on Android
Using the Presentation API and external screens on AndroidUsing the Presentation API and external screens on Android
Using the Presentation API and external screens on AndroidXavier Hallade
 
Google flutter the easy and practical way IEEE Alazhar
Google flutter the easy and practical way IEEE AlazharGoogle flutter the easy and practical way IEEE Alazhar
Google flutter the easy and practical way IEEE AlazharAhmed Abu Eldahab
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An IntroductionBehzad Altaf
 

What's hot (20)

[Android] Multimedia Programming
[Android] Multimedia Programming[Android] Multimedia Programming
[Android] Multimedia Programming
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
Getting Git
Getting GitGetting Git
Getting Git
 
What is Kotlin Multiplaform? Why & How?
What is Kotlin Multiplaform? Why & How? What is Kotlin Multiplaform? Why & How?
What is Kotlin Multiplaform? Why & How?
 
Gstreamer: an Overview
Gstreamer: an OverviewGstreamer: an Overview
Gstreamer: an Overview
 
Introduction to Flutter
Introduction to FlutterIntroduction to Flutter
Introduction to Flutter
 
INTRODUCTION TO FLUTTER.pdf
INTRODUCTION TO FLUTTER.pdfINTRODUCTION TO FLUTTER.pdf
INTRODUCTION TO FLUTTER.pdf
 
Flutter Bootcamp
Flutter BootcampFlutter Bootcamp
Flutter Bootcamp
 
Google flutter the easy and practical way
Google flutter the easy and practical wayGoogle flutter the easy and practical way
Google flutter the easy and practical way
 
Building beautiful apps with Google flutter
Building beautiful apps with Google flutterBuilding beautiful apps with Google flutter
Building beautiful apps with Google flutter
 
Intro to Flutter SDK
Intro to Flutter SDKIntro to Flutter SDK
Intro to Flutter SDK
 
Introduction to Vault
Introduction to VaultIntroduction to Vault
Introduction to Vault
 
Flutter introduction
Flutter introductionFlutter introduction
Flutter introduction
 
Hashicorp Vault ppt
Hashicorp Vault pptHashicorp Vault ppt
Hashicorp Vault ppt
 
What is flutter and why should i care?
What is flutter and why should i care?What is flutter and why should i care?
What is flutter and why should i care?
 
Introduction to Qt Creator
Introduction to Qt CreatorIntroduction to Qt Creator
Introduction to Qt Creator
 
Using the Presentation API and external screens on Android
Using the Presentation API and external screens on AndroidUsing the Presentation API and external screens on Android
Using the Presentation API and external screens on Android
 
Google flutter the easy and practical way IEEE Alazhar
Google flutter the easy and practical way IEEE AlazharGoogle flutter the easy and practical way IEEE Alazhar
Google flutter the easy and practical way IEEE Alazhar
 
Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)
 
Git - An Introduction
Git - An IntroductionGit - An Introduction
Git - An Introduction
 

Viewers also liked

Standalone Android Apps in Python
Standalone Android Apps in PythonStandalone Android Apps in Python
Standalone Android Apps in PythonBaptiste Lagarde
 
Creando Aplicaciones para Android con Kivy
Creando Aplicaciones para Android con KivyCreando Aplicaciones para Android con Kivy
Creando Aplicaciones para Android con KivyNahuel Defossé
 
Desarrollo de aplicaciones multiplataforma con python y Kivy
Desarrollo de aplicaciones multiplataforma con python y KivyDesarrollo de aplicaciones multiplataforma con python y Kivy
Desarrollo de aplicaciones multiplataforma con python y KivyErnesto Crespo
 
Palestra Apresentando Python e Suas Aplicações
Palestra Apresentando Python e Suas AplicaçõesPalestra Apresentando Python e Suas Aplicações
Palestra Apresentando Python e Suas AplicaçõesMarcos Thomaz
 
Desenvolvendo aplicações Mobile em Python
Desenvolvendo aplicações Mobile em PythonDesenvolvendo aplicações Mobile em Python
Desenvolvendo aplicações Mobile em PythonRelsi Maron
 
Kivy - Python Nordeste 2013
Kivy - Python Nordeste 2013Kivy - Python Nordeste 2013
Kivy - Python Nordeste 2013Diego Dukão
 
Desenvolvendo Aplicações Web com Python
Desenvolvendo Aplicações Web com PythonDesenvolvendo Aplicações Web com Python
Desenvolvendo Aplicações Web com PythonLuiz Cláudio Silva
 
A Basic Django Introduction
A Basic Django IntroductionA Basic Django Introduction
A Basic Django IntroductionGanga Ram
 
Extracción de datos de páginas web con Python (webscraping)
Extracción de datos de páginas web con Python (webscraping)Extracción de datos de páginas web con Python (webscraping)
Extracción de datos de páginas web con Python (webscraping)Ernesto Crespo
 
Mikrotik ultimo manual
Mikrotik ultimo manualMikrotik ultimo manual
Mikrotik ultimo manualChristian Val
 
Mikrotik passo a passo
Mikrotik   passo a passoMikrotik   passo a passo
Mikrotik passo a passoIvan de Sousa
 
Python para iniciantes
Python para iniciantesPython para iniciantes
Python para iniciantesrichardsonlima
 

Viewers also liked (17)

Standalone Android Apps in Python
Standalone Android Apps in PythonStandalone Android Apps in Python
Standalone Android Apps in Python
 
Kivy for you
Kivy for youKivy for you
Kivy for you
 
Creando Aplicaciones para Android con Kivy
Creando Aplicaciones para Android con KivyCreando Aplicaciones para Android con Kivy
Creando Aplicaciones para Android con Kivy
 
Desarrollo de aplicaciones multiplataforma con python y Kivy
Desarrollo de aplicaciones multiplataforma con python y KivyDesarrollo de aplicaciones multiplataforma con python y Kivy
Desarrollo de aplicaciones multiplataforma con python y Kivy
 
Palestra Apresentando Python e Suas Aplicações
Palestra Apresentando Python e Suas AplicaçõesPalestra Apresentando Python e Suas Aplicações
Palestra Apresentando Python e Suas Aplicações
 
Desenvolvendo aplicações Mobile em Python
Desenvolvendo aplicações Mobile em PythonDesenvolvendo aplicações Mobile em Python
Desenvolvendo aplicações Mobile em Python
 
Kivy - Python Nordeste 2013
Kivy - Python Nordeste 2013Kivy - Python Nordeste 2013
Kivy - Python Nordeste 2013
 
Desenvolvendo Aplicações Web com Python
Desenvolvendo Aplicações Web com PythonDesenvolvendo Aplicações Web com Python
Desenvolvendo Aplicações Web com Python
 
A Basic Django Introduction
A Basic Django IntroductionA Basic Django Introduction
A Basic Django Introduction
 
Extracción de datos de páginas web con Python (webscraping)
Extracción de datos de páginas web con Python (webscraping)Extracción de datos de páginas web con Python (webscraping)
Extracción de datos de páginas web con Python (webscraping)
 
Curso oficial Mikrotik
Curso oficial MikrotikCurso oficial Mikrotik
Curso oficial Mikrotik
 
Mikrotik ultimo manual
Mikrotik ultimo manualMikrotik ultimo manual
Mikrotik ultimo manual
 
Mikrotik passo a passo
Mikrotik   passo a passoMikrotik   passo a passo
Mikrotik passo a passo
 
Python para iniciantes
Python para iniciantesPython para iniciantes
Python para iniciantes
 
Curso de Python e Django
Curso de Python e DjangoCurso de Python e Django
Curso de Python e Django
 
Xamarin.forms入門
Xamarin.forms入門Xamarin.forms入門
Xamarin.forms入門
 
Sem5 2016 (1)
Sem5 2016 (1)Sem5 2016 (1)
Sem5 2016 (1)
 

Similar to Kivy - Python UI Library for Any Platform

Flask jwt authentication tutorial
Flask jwt authentication tutorialFlask jwt authentication tutorial
Flask jwt authentication tutorialKaty Slemon
 
Vipul divyanshu documentation on Kinect and Motion Tracking
Vipul divyanshu documentation  on Kinect and Motion TrackingVipul divyanshu documentation  on Kinect and Motion Tracking
Vipul divyanshu documentation on Kinect and Motion TrackingVipul Divyanshu
 
Fastlane for Androidによる継続的デリバリー
Fastlane for Androidによる継続的デリバリーFastlane for Androidによる継続的デリバリー
Fastlane for Androidによる継続的デリバリーFumiya Nakamura
 
Princeton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance ToolingPrinceton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance ToolingHenry Schreiner
 
WordPress in 30 minutes
WordPress in 30 minutesWordPress in 30 minutes
WordPress in 30 minutesOwen Winkler
 
Comment développer sur la console Xbox One avec une application Universal Win...
Comment développer sur la console Xbox One avec une application Universal Win...Comment développer sur la console Xbox One avec une application Universal Win...
Comment développer sur la console Xbox One avec une application Universal Win...Microsoft
 
Dailymotion presenting xbox one experience days by damien delaire
Dailymotion presenting xbox one experience days by damien delaireDailymotion presenting xbox one experience days by damien delaire
Dailymotion presenting xbox one experience days by damien delaireDamien Delaire
 
Gdc09 Minigames
Gdc09 MinigamesGdc09 Minigames
Gdc09 MinigamesSusan Gold
 
The Ring programming language version 1.7 book - Part 82 of 196
The Ring programming language version 1.7 book - Part 82 of 196The Ring programming language version 1.7 book - Part 82 of 196
The Ring programming language version 1.7 book - Part 82 of 196Mahmoud Samir Fayed
 
Introduction to Box2D Physics Engine
Introduction to Box2D Physics EngineIntroduction to Box2D Physics Engine
Introduction to Box2D Physics Enginefirstthumb
 
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet Pôle Systematic Paris-Region
 
GitGot: The Swiss Army Chainsaw of Git Repo Management
GitGot: The Swiss Army Chainsaw of Git Repo ManagementGitGot: The Swiss Army Chainsaw of Git Repo Management
GitGot: The Swiss Army Chainsaw of Git Repo ManagementJohn Anderson
 
Codeception Testing Framework -- English #phpkansai
Codeception Testing Framework -- English #phpkansaiCodeception Testing Framework -- English #phpkansai
Codeception Testing Framework -- English #phpkansaiFlorent Batard
 
The Ring programming language version 1.6 book - Part 7 of 189
The Ring programming language version 1.6 book - Part 7 of 189The Ring programming language version 1.6 book - Part 7 of 189
The Ring programming language version 1.6 book - Part 7 of 189Mahmoud Samir Fayed
 
PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!Blanca Mancilla
 
Python virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesPython virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesLarry Cai
 
Développer sur la console Xbox One avec une application UWP. Les retours d'éx...
Développer sur la console Xbox One avec une application UWP. Les retours d'éx...Développer sur la console Xbox One avec une application UWP. Les retours d'éx...
Développer sur la console Xbox One avec une application UWP. Les retours d'éx...Dailymotion
 
Open source software for startups
Open source software for startupsOpen source software for startups
Open source software for startupsvictorneo
 

Similar to Kivy - Python UI Library for Any Platform (20)

Flask jwt authentication tutorial
Flask jwt authentication tutorialFlask jwt authentication tutorial
Flask jwt authentication tutorial
 
Vipul divyanshu documentation on Kinect and Motion Tracking
Vipul divyanshu documentation  on Kinect and Motion TrackingVipul divyanshu documentation  on Kinect and Motion Tracking
Vipul divyanshu documentation on Kinect and Motion Tracking
 
Fastlane for Androidによる継続的デリバリー
Fastlane for Androidによる継続的デリバリーFastlane for Androidによる継続的デリバリー
Fastlane for Androidによる継続的デリバリー
 
Princeton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance ToolingPrinceton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance Tooling
 
WordPress in 30 minutes
WordPress in 30 minutesWordPress in 30 minutes
WordPress in 30 minutes
 
Comment développer sur la console Xbox One avec une application Universal Win...
Comment développer sur la console Xbox One avec une application Universal Win...Comment développer sur la console Xbox One avec une application Universal Win...
Comment développer sur la console Xbox One avec une application Universal Win...
 
Dailymotion presenting xbox one experience days by damien delaire
Dailymotion presenting xbox one experience days by damien delaireDailymotion presenting xbox one experience days by damien delaire
Dailymotion presenting xbox one experience days by damien delaire
 
Git::Hooks
Git::HooksGit::Hooks
Git::Hooks
 
Survey_Paper
Survey_PaperSurvey_Paper
Survey_Paper
 
Gdc09 Minigames
Gdc09 MinigamesGdc09 Minigames
Gdc09 Minigames
 
The Ring programming language version 1.7 book - Part 82 of 196
The Ring programming language version 1.7 book - Part 82 of 196The Ring programming language version 1.7 book - Part 82 of 196
The Ring programming language version 1.7 book - Part 82 of 196
 
Introduction to Box2D Physics Engine
Introduction to Box2D Physics EngineIntroduction to Box2D Physics Engine
Introduction to Box2D Physics Engine
 
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
PyData Paris 2015 - Track 3.2 Serge Guelton et Pierrick Brunet
 
GitGot: The Swiss Army Chainsaw of Git Repo Management
GitGot: The Swiss Army Chainsaw of Git Repo ManagementGitGot: The Swiss Army Chainsaw of Git Repo Management
GitGot: The Swiss Army Chainsaw of Git Repo Management
 
Codeception Testing Framework -- English #phpkansai
Codeception Testing Framework -- English #phpkansaiCodeception Testing Framework -- English #phpkansai
Codeception Testing Framework -- English #phpkansai
 
The Ring programming language version 1.6 book - Part 7 of 189
The Ring programming language version 1.6 book - Part 7 of 189The Ring programming language version 1.6 book - Part 7 of 189
The Ring programming language version 1.6 book - Part 7 of 189
 
PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!PyLadies Talk: Learn to love the command line!
PyLadies Talk: Learn to love the command line!
 
Python virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutesPython virtualenv & pip in 90 minutes
Python virtualenv & pip in 90 minutes
 
Développer sur la console Xbox One avec une application UWP. Les retours d'éx...
Développer sur la console Xbox One avec une application UWP. Les retours d'éx...Développer sur la console Xbox One avec une application UWP. Les retours d'éx...
Développer sur la console Xbox One avec une application UWP. Les retours d'éx...
 
Open source software for startups
Open source software for startupsOpen source software for startups
Open source software for startups
 

Recently uploaded

My Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle BaileyMy Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle Baileyhlharris
 
SOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdf
SOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdfSOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdf
SOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdfMahamudul Hasan
 
lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lodhisaajjda
 
Dreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio IIIDreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio IIINhPhngng3
 
Unlocking Exploration: Self-Motivated Agents Thrive on Memory-Driven Curiosity
Unlocking Exploration: Self-Motivated Agents Thrive on Memory-Driven CuriosityUnlocking Exploration: Self-Motivated Agents Thrive on Memory-Driven Curiosity
Unlocking Exploration: Self-Motivated Agents Thrive on Memory-Driven CuriosityHung Le
 
Report Writing Webinar Training
Report Writing Webinar TrainingReport Writing Webinar Training
Report Writing Webinar TrainingKylaCullinane
 
Dreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video TreatmentDreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video Treatmentnswingard
 
Zone Chairperson Role and Responsibilities New updated.pptx
Zone Chairperson Role and Responsibilities New updated.pptxZone Chairperson Role and Responsibilities New updated.pptx
Zone Chairperson Role and Responsibilities New updated.pptxlionnarsimharajumjf
 
Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...
Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...
Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...David Celestin
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoKayode Fayemi
 
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdfAWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdfSkillCertProExams
 
Digital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of DrupalDigital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of DrupalFabian de Rijk
 
Introduction to Artificial intelligence.
Introduction to Artificial intelligence.Introduction to Artificial intelligence.
Introduction to Artificial intelligence.thamaeteboho94
 
Jual obat aborsi Jakarta 085657271886 Cytote pil telat bulan penggugur kandun...
Jual obat aborsi Jakarta 085657271886 Cytote pil telat bulan penggugur kandun...Jual obat aborsi Jakarta 085657271886 Cytote pil telat bulan penggugur kandun...
Jual obat aborsi Jakarta 085657271886 Cytote pil telat bulan penggugur kandun...ZurliaSoop
 
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...amilabibi1
 

Recently uploaded (17)

My Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle BaileyMy Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle Bailey
 
SOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdf
SOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdfSOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdf
SOLID WASTE MANAGEMENT SYSTEM OF FENI PAURASHAVA, BANGLADESH.pdf
 
lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.
 
Dreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio IIIDreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio III
 
Unlocking Exploration: Self-Motivated Agents Thrive on Memory-Driven Curiosity
Unlocking Exploration: Self-Motivated Agents Thrive on Memory-Driven CuriosityUnlocking Exploration: Self-Motivated Agents Thrive on Memory-Driven Curiosity
Unlocking Exploration: Self-Motivated Agents Thrive on Memory-Driven Curiosity
 
Report Writing Webinar Training
Report Writing Webinar TrainingReport Writing Webinar Training
Report Writing Webinar Training
 
Dreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video TreatmentDreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video Treatment
 
Zone Chairperson Role and Responsibilities New updated.pptx
Zone Chairperson Role and Responsibilities New updated.pptxZone Chairperson Role and Responsibilities New updated.pptx
Zone Chairperson Role and Responsibilities New updated.pptx
 
Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...
Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...
Proofreading- Basics to Artificial Intelligence Integration - Presentation:Sl...
 
ICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdfICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdf
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac Folorunso
 
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdfAWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
 
in kuwait௹+918133066128....) @abortion pills for sale in Kuwait City
in kuwait௹+918133066128....) @abortion pills for sale in Kuwait Cityin kuwait௹+918133066128....) @abortion pills for sale in Kuwait City
in kuwait௹+918133066128....) @abortion pills for sale in Kuwait City
 
Digital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of DrupalDigital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of Drupal
 
Introduction to Artificial intelligence.
Introduction to Artificial intelligence.Introduction to Artificial intelligence.
Introduction to Artificial intelligence.
 
Jual obat aborsi Jakarta 085657271886 Cytote pil telat bulan penggugur kandun...
Jual obat aborsi Jakarta 085657271886 Cytote pil telat bulan penggugur kandun...Jual obat aborsi Jakarta 085657271886 Cytote pil telat bulan penggugur kandun...
Jual obat aborsi Jakarta 085657271886 Cytote pil telat bulan penggugur kandun...
 
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
 

Kivy - Python UI Library for Any Platform

  • 2. In this Session we shall discuss:  How to setup kivy  Some key features of kivy  Make a simple ‘Hello World’ application  Introduce the ‘kv’ language  Package the application for the android market
  • 3. Setting up Kivy 3 very simple commands: 1. Add Source  sudo add-apt-repository ppa:kivy-team/kivy 2. Update  sudo apt-get update 3. Install Kivy  sudo apt-get install python-kivy 
  • 4. Basic Components of Kivy § App § Widget § ScreenManger § Screen § Layouts § Button § Label § TextInput § Image § Clock § SoundLoader § Animation
  • 5. Types of Layouts § Anchor Layout § Box Layout § Float Layout § Relative Layout § Grid Layout § Stack Layout
  • 6. Hello World f r o m k i v y . a p p i m p o r t A p p f r o m k i v y . u i x . f l o a t l a y o u t i m p o r t F l o a t L a y o u t f r o m k i v y . u i x . b u t t o n i m p o r t B u t t o n f r o m k i v y . u i x . l a b e l i m p o r t L a b e l c l a s s M y A p p ( A p p ) : t i t l e = ' H e l l o W o r l d ' d e f b u i l d ( s e l f ) : s e l f . a p p w i n d o w = F l o a t L a y o u t ( ) b u t t o n = B u t t o n ( t e x t = ' C l i c k H e r e ' ) b u t t o n . b i n d ( o n _ r e l e a s e = s e l f . b u t t o n p r e s s ) s e l f . a p p w i n d o w . a d d _ w i d g e t ( b u t t o n ) r e t u r n s e l f . a p p w i n d o w d e f b u t t o n p r e s s ( s e l f , * a r g s ) : s e l f . a p p w i n d o w . c l e a r _ w i d g e t s ( ) s e l f . a p p w i n d o w . a d d _ w i d g e t ( L a b e l ( t e x t = ' H e l l o W o r l d ! ' ) ) i f _ _ n a m e _ _ = = ' _ _ m a i n _ _ ' : g l o b a l m y a p p m y a p p = M y A p p ( ) m y a p p . r u n ( )
  • 7. The ‘kv’ Language class MyButton(Button): def __init__(self,**kwargs): super(MyButton,self).__init__(**kwargs) <MyButton>: size_hint_x: None size_hint_y: None In the kv file: In the python file:
  • 8. Packaging the app There are two ways to package the app: 1. Manually using python-for-android 2. 3. Automatically using buildozer
  • 9. Prerequisites for manual packaging: § Build-Essential and others: § sudo apt-get install build-essential patch git-core ccache ant python-pip python-dev § Latest Cython: § Pip install –upgrade cython § Android SDK § http://developer.android.com/sdk/index.html § Android NDK § http://developer.android.com/sdk/ndk/index.html § Environment variables § export ANDROIDSDK=/path/to/android-sdk § export ANDROIDNDK=/path/to/android-ndk § export ANDROIDNDKVER=rX § export ANDROIDAPI=X § export PATH=$ANDROIDNDK:$ANDROIDSDK/platform-tools:$ANDROIDSDK/tools: $PATH §
  • 10. Manually § Get python-for-android: § git clone git://github.com/kivy/python-for-android § Create distribution: § ./distribute.sh -m "kivy" § Build apk: § cd dist/default § ./build.py --dir <path to your app> --name "<title>" --package <org.of.your.app> --version <human version> --icon <path to an icon to use> --orientation <landscape|portrait> --permission <android permission like VIBRATE> (multiple allowed) <debug|release>
  • 11. Automatic Packaging using buildozer: § Get buildozer: § git clone https://github.com/kivy/buildozer.git § cd buildozer § sudo python2.7 setup.py install § Create spec file: § cd path/to/app § buildozer init § Build: § buildozer android <debug|release>
  • 12. Signing and Aligning (Only for Release apk) § Generate keystore § keytool -genkey -v -keystore path/to/keystore/name.keystore -alias myalias -keyalg RSA -keysize 2048 -validity 10000 § <New Password> § Sign using keystore § jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore ./keystores/com-mydomain- myapp.keystore ./myapp/bin/MyApp-1.0.0- release-unsigned.apk myalias § <keystore password> § Zipalign § ~/.buildozer/android/platform/android-sdk- 21/tools/zipalign -v 4 ./myapp/bin/MyApp-1.0.0- release-unsigned.apk ./myapp/bin/MyApp- 1.0.0.apk
  • 13. All Done! Congratulations on your first apk!