Slide 1

Slide 1 text

The Future of GUI Programming with Python

Slide 2

Slide 2 text

Me • Call me TP • Follow @uranusjr • https://uranusjr.com

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

http://macdown.uranusjr.com

Slide 6

Slide 6 text

www. .com

Slide 7

Slide 7 text

Terminology • User interacts with a program through a user interface (UI) • A UI based on images is a graphical user interface (GUI)

Slide 8

Slide 8 text

I want a GUI library that works. works

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

What I Want • Native UI and UX • Portability • Ease to deploy • Pythonic API

Slide 11

Slide 11 text

What We Have

Slide 12

Slide 12 text

Tkinter • “Python’s de-facto standard GUI” • Native nowhere • Themed Tk • Binding to Tcl/Tk • Lean, but may be lacking

Slide 13

Slide 13 text

Platform-specific • PyObjC on OS X (Cocoa) • Win32API on Windows • PyGObject on Gnome (GTK+) • Native UI/UX • Needs to deploy C binding • Very weird API

Slide 14

Slide 14 text

Special Interpreters • .NET via IronPython (Windows) • AWT/Swing via Jython • Weird API • Compatibility with other libraries

Slide 15

Slide 15 text

Binding to Third-party • PyQt and PySide to Qt • wxPython to wxWidgets • Works quite natively • Cross-platform application code • Weird API • Needs to deploy tons of things

Slide 16

Slide 16 text

“Let’s Build Everything” • Kivy and Pyglet • Cross-platform application code • Nice Pythonic API • Needs to deploy C binding • Not native (and they don’t care)

Slide 17

Slide 17 text

Solution UI/UX Portable API Deploy Tkinter Meh Platform-specific Meh Jython Meh Meh Third-party Bindings Kivy / Pyglet Meh

Slide 18

Slide 18 text

Licensing • GPL and LGPL • Source distribution • Static linking

Slide 19

Slide 19 text

So?

Slide 20

Slide 20 text

What I Want • Native UI and UX • Portability • Ease to deploy • Pythonic API

Slide 21

Slide 21 text

The Solution (IMO) • Dynamic binding to native GUI • CPython compatibility • No non-Python dependencies • Wrapper API on top

Slide 22

Slide 22 text

Native API Python API Wrapper Binding (in Python)

Slide 23

Slide 23 text

The Binding • Foreign function interface • libffi • ctypes • CFFI, anyone?

Slide 24

Slide 24 text

Native API Python API Wrapper ctypes

Slide 25

Slide 25 text

Native API Python API Wrapper GTK+ ctypes PyGObject

Slide 26

Slide 26 text

Native API Python API Wrapper ctypes

Slide 27

Slide 27 text

Native API C API (e.g. CoreFoundation) Python API Wrapper ctypes Objective-C API ctypes + wrapper

Slide 28

Slide 28 text

IUUQQZCFFPSHUPHB

Slide 29

Slide 29 text

How?

Slide 30

Slide 30 text

toga toga-win32 toga-cocoa toga-gtk … rubicon PyGObject ctypes Native GUI Library

Slide 31

Slide 31 text

toga toga-win32 toga-cocoa toga-gtk … rubicon PyGObject ctypes Native GUI Library

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

……

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

Difficulties • API design • Platform knowledge • UI Layout

Slide 38

Slide 38 text

https://github.com/pybee/toga

Slide 39

Slide 39 text

WHAT IF I AM INTERESTED IN SOMETHING ELSE?

Slide 40

Slide 40 text

Did I hear mobile?

Slide 41

Slide 41 text

lwn.net/Articles/640625/ You might also want to read this.

Slide 42

Slide 42 text

Mobile Support • API availability • The Store • “Paradigm mismatch”

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

Python Issue #23670 Modifications to support iOS as a cross-compilation target

Slide 45

Slide 45 text

No content

Slide 46

Slide 46 text

?

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

No content

Slide 50

Slide 50 text

Recap • What we have is not good enough • Proposed solution • Python on mobile OSs

Slide 51

Slide 51 text

WHAT IF I AM INTERESTED IN SOMETHING ELSE?