Site icon Embarcadero RAD Studio, Delphi, & C++Builder Blogs

Python on Android with Delphi FMX – The Cross Platform GUI Framework

python on android with delphi fmx the cross platform gui framework

Discover how Embarcadero’s new free Python modules bring the power and flexibility of Delphi’s GUI frameworks to Python GUI. VCL and FireMonkey (FMX) are mature graphical user interface libraries. VCL is primarily used for native Windows development, whereas FireMonkey provides a powerful and flexible GUI framework for Windows, Linux, macOS, and even Android.

In this webinar, we will introduce you to these new free Python modules and show you how to use them to create graphical user interfaces with Python. Part 2 will show you how to target Android GUI applications with Python! We recommend using a python android app builder software for cross-platform GUI framework creation so that your experience is smooth and you can maximize your python potential!

Who are you?

Python devs who want a nice GUI
● Python devs curious about Delphi
● Delphi devs who want to use Python
● Delphi devs curious about what’s new
● Other devs curious about Delphi & Python

It’s not a Competition

● Developers have multiple tools on their workbench
● It is about finding the right tool for each task
● Having specialized tools for different tasks doesn’t detract from favorite tools
● You can always find a specific task that another tool is better for, but no one tool is that best for all tasks.

What is Delphi for Python?

Dissecting the Technology Stacks

FMX The Cross-Platform (FireMonkey Framework)

  • Takes advantage of GPU libraries to provide a hardware accelerated, rich user interface that is fast and looks great across multiple platforms:
    • Windows, macOS, iOS, Android, and Linux
    • Uses DirectX on Windows, OpenGL on Linux, OpenGL-ES on Android, and Metal on iOS and macOS
  • Similar to VCL, but not designed to be compatible
    • Designed as cross platform from the ground up
  • Integrated GPU effects, animations, and robust styling system
  • Platform services abstract the access to platform hardware and functionality to intelligently adapt the UI & UX to platform specifics
  • Very flexible component system – do more with fewer components

Delphi for Python

Delphi FMX for Python Installation

Hello World (The simplest example)

https://github.com/Embarcadero/DelphiFMX4Python/blob/main/samples/Simplest.py

Hello World (An Object Oriented example)

https://github.com/Embarcadero/DelphiFMX4Python/blob/main/samples/HelloDelphiFMX.py

ToDo App (Starting to get useful….)

https://github.com/Embarcadero/DelphiFMX4Python/blob/main/samples/ToDoList.py

With Style (And more controls)

https://github.com/Embarcadero/DelphiFMX4Python/tree/main/samples/ControlsDesktop

Design Your UI (in the Delphi IDE)

● Take full advantage of the Delphi IDE designers and property editors
● WYSIWYG preview with styles
● Export the form for use in Python then write Python code
● Just right-click and export with the IDE add-in
● Works with any Delphi edition requires no Object Pascal
github.com/Embarcadero/DelphiFMX4Python/tree/main/experts
Currently uses a binary .pydfm file, but text version coming

Exported from Delphi’s FMX Designers to Python (with Styles)

Exported from Delphi’s FMX Designers to Python (with Styles and Animations)

Deploying Python to Android… Yes, Python on Android! (The Architecture)

Fundamentals

Solution

To Do

Running Python on Android

● Delphi compiles natively for Android
● The Python runtime is embedded into the app
● Python is dynamically interpreted and executed at runtime
● All of Delphi FMX for Python is available
● Supports additional Python modules
● Completely local – no network access necessary

https://github.com/Embarcadero/PythonFMXBuilder

Combine Delphi and Python

Use Delphi to Create Native Python Modules

● Many Python modules are written in C/C++ and natively compiled
● Delphi also creates natively compiled Python modules via Python4Delphi
● Prototype rapidly in Python, and then create optimized modules in Delphi to clear bottlenecks
● Much like Python, Delphi code is focused on readability and clear structure and may be easier for you than using C/C++
● Augment your use of PyPy or Cython

Documentation and Library References

About PyScripter

● Popular open-source Python IDE sponsored by Embarcadero
● All the features expected in a modern Python IDE while being lightweight and very fast
● Natively compiled for Windows to use minimal memory with maximum performance
● Full Python debugging with remote debugging
● Integration with Python tools like PyLint, TabNanny, Profile, etc.
● Run or debug files from memory.
embarcadero.com/free-tools/pyscripter/free-download

About UltraEdit

Next Steps

Interested in building Linux applications with FireMonkey? Try the Cross-Platform Development Framework, which can help you create & design apps in Delphi or C++ environments.

Exit mobile version