10
Create ubuntu apps with python Danial Behzadi [email protected]

Creating Ubuntu apps with Qt an Python

Embed Size (px)

Citation preview

Page 1: Creating Ubuntu apps with Qt an Python

Create ubuntu apps with python

Danial Behzadi

[email protected]

Page 2: Creating Ubuntu apps with Qt an Python

2016 Pycon Iran 2

ubuntu SDK

Page 3: Creating Ubuntu apps with Qt an Python

2016 Pycon Iran 3

Python bindings for Qt

● PyQt

● PySide

● PyOtherSide

Page 4: Creating Ubuntu apps with Qt an Python

2016 Pycon Iran 4

PyQt

● Pros– GPL license

– Qt 4 & 5

– Python 2 & 3

● Cons– Synchronous by default

– Slow startup

● Riverbank Computing in 1998● Cpython + Python code + Bindings + Qt● Python Interpreter uses Qt to display UI

Page 5: Creating Ubuntu apps with Qt an Python

2016 Pycon Iran 5

PySide

● Pros– Python 2 & 3

● Cons– Synchronous by default

– Big size (> 15 MiB)

– Slow startup

– Qt 4 only

● Nokia in 2009● Cpython + Python code + Bindings + Qt● Python Interpreter uses QML to display UI● LGPL license

Page 6: Creating Ubuntu apps with Qt an Python

2016 Pycon Iran 6

PyOtherSide

● Pros– Asynchronous calls

– Small size (< 150 KiB)

– Fast startup

● Cons– BSD license

● Thp (from Mer) in 2011● Qt Plugin + Python library● QML as frontend, uses Python as backend● Qt 5 and Python 3

Page 7: Creating Ubuntu apps with Qt an Python

2016 Pycon Iran 7

PyOtherSide Platforms● Desktop (GNU/Linux, Windows, Mac, etc.)

– Fully Supported

● GNU/Linux phones (Ubuntu, Sailfish)– Fully Supported

● Other phones– Android: Ship Python 3, Qt 5 and PyOtherSide in app

– Blackberry: Ship Qt 5 and PyOtherSide in app

Page 8: Creating Ubuntu apps with Qt an Python

2016 Pycon Iran 8

PyOtherSide API

● QML Methods

addImportPath(p)

setHandler(e, c)

importModule(n, c)

call(f, a, c)

evaluate(expr)

● QML Signals

recieved(data)

error(traceback)

● Python Module

import pyotherside

pyotherside.send(*args)

pyotherside.atexit(f)

Page 9: Creating Ubuntu apps with Qt an Python

2016 Pycon Iran 9

Sample code and explanation

Watch it live!

Page 10: Creating Ubuntu apps with Qt an Python

2016 Pycon Iran 10

Thanks!