Разработка мобильных приложений на Python

 

 

 

 

 

                                                           Станислав Каблуков                           

Kivy

Как это работает?

  • Код на Python
  • Фреймворк Kivy
  • KV разметка 
  • Упаковка вместе с Сython
  • Генерация нативного bootstrap

Python

  • Python = 2.7 Python=3
  • cPython
  • PyGame

Kivy Framework

  • Canvas(PyGame, X11, SDL, EGL)
  • Native Events (HID, VM_Touch, Mac Touch ...)
  • Modules
  • GPU acceleration
  • RAW OpenGL support
  • MultiThread
  • OpenSource
  • MIT license
  • Properties
  • StringProperty
  • NumericProperty
  • ObjectProperty
  • DictProperty
  • ListProperty
  • BooleanProperty
  • ReferenceListProperty

Properties

Примеры

from kivy.properties import * 
from date time import date
				 
my_int = NumericProperty(42) 
my_string = StringProperty('My string') 
my_dict = DictProperty({'key': 'value'}) 
my_obj = ObjectProperty(date()) 
my_ref = referenceListProperty(
      my_int, my_string, my_dict, my_obj
 )

Layout System

  • BoxLayout
  • GridLayout
  • StackLayout
  • AnchorLayout
  • FloatLayout

KV Language

MyRootWidget:
    BoxLayout:
        Button:
        Button:

Это все еще Python

MyWidget:

    cols: len(some_data_from_python_file)

    on_size: my_callback_method

    pos: self.center_x / 2, self.center_y * 2
 root = MyRootWidget()
                       
 box = BoxLayout()

 box.add_widget(Button())

 box.add_widget(Button())

 root.add_widget(box)

KV Language

 

 

Работа с текстом

Label

Build and distribute

 

PyInstaller (Windows, OS X)

pip(Linux)

KV tool/ Python for android/ Buildozer(Android)

Build and distribute... iOS

Build and distribute... iOS

1.Compile Python and Modules 

2. Create Xcode project

3. Insert your code in project

4. Link Python and modules

5. Customize (title, icons, etc)

6. Try build

Links

  • http://kivy.org
  • https://github.com/kivy

NEW Kivy

By Станислав