Академический Документы
Профессиональный Документы
Культура Документы
Linux
!indo"s
#acOS$
%ndroid and
IOS
%ou can run t!e same code on all supported platforms#
&t can use natively most input protocols and devices like
*loc&
%ou can use t!e clock to sc!edule timer events# 'ot! one-s!ot timers and periodic
timers are supported
*ache
&f you need to cac!e somet!ing t!at you use often" you can use our class for t!at
instead of writing your own#
'esture -etection
2e s!ip a simple gesture recogni9er t!at you can use to detect various kinds of
strokes" suc! as circles or rectangles# %ou can train it to detect your own strokes#
Kivy Lan,ua,e
-!e kivy language is used to easily and efficiently describe user interfaces#
Properties
-!ese are not t!e normal properties t!at you may know from pyt!on# -!ey are
our own property classes t!at link your widget code wit! t!e user interface
description#
Nik Klever University of Applied Sciences Augsburg
U&5 42idgets : ayouts6
-!e U&5 module contains commonly used widgets and layouts t!at you can
reuse to 7uickly create a user interface#
!id,ets
2idgets are user interface elements t!at you add to your program to provide
some kind of functionality# -!ey may or may not be visible# ;/amples
would be a file browser" buttons" sliders" lists and so on# 2idgets receive
0otion;vents#
Layouts
%ou use layouts to arrange widgets# &t is of course possible to calculate your
widgets8 positions yourself" but often it is more convenient to use one of our
ready made layouts# ;/amples would be +rid ayouts or 'o/ ayouts# %ou
can also nest layouts#
Nik Klever University of Applied Sciences Augsburg
&nput ;vents 4 -ouc!es 6
Kivy abstracts different input types and sources suc! as touc!es" mice" -U&O or similar#
2!at all of t!ese input types !ave in common is t!at you can associate a .< onscreen-position
wit! any individual input event#
All of t!ese input types are represented by instances of t!e -ouc!46 class# A touc! instance" or
ob3ect" can be in one of t!ree states# 2!en a touc! enters one of t!ese states" your program is
informed t!at t!e event occurred# -!e t!ree states a touc! can be in are1
-o"n
A touc! is down only once" at t!e very moment w!ere it first appears#
#ove
A touc! can be in t!is state for a potentially unlimited time# A touc! does not !ave to be in t!is
state during its lifetime# A =0ove8 !appens w!enever t!e .< position of a touc! c!anges#
Up
A touc! goes up at most once" or never# &n practice you will almost always receive an up event
because nobody is going to !old a finger on t!e screen for all eternity" but it is not guaranteed#
&f you know t!e input sources your users will be using" you will know w!et!er or not you can
rely on t!is state being entered#
Nik Klever University of Applied Sciences Augsburg
;vents and $roperties
Nik Klever University of Applied Sciences Augsburg
-utorial ;/ample Pon,
Pon, is an easy" small and very common e/ample of t!e old $ing-$ong Computer
+ame > it is introduced as a tutorial for Kivy on t!e site
!ttp1??kivy#org?docs?tutorials?pong#!tml
!hat is needed . <ownload Kivy as described on t!e <ownload Site
/o"0o1(xample on %ndroid1
(# <ownload t!e Kivy aunc!er App from t!e +oogle $lay Store
.# Create a directory named &ivy in t!e root-directory on t!e storage of your Android
smartp!one
,# Create a directory named pon, in t!is directory
@# Copy t!e files main2py and pon,2&v into t!is directory pong
A# Create a file name android2txt wit! t!e following content1
title=Pong Tutorial
author=KivyTeam
orientation=landscape
B# Cun t!e application Kivy Launcher and select Pon, 0utorial
D# C!ange pong#kv for your special needs 4e#g# introduce a Color6
Nik Klever University of Applied Sciences Augsburg
Euestions F
Kivy is well documented on itGs 2ebsite
!ttp1??www#kivy#org
-!anks to all contributors of Kivy" especially t!e core team
0at!ieu Hirbel
-!omas Iansen
+abriel $ettier