Learn how Embarcadero’s newly released free Python GUI modules bring the power and flexibility of Delphi’s GUI frameworks to Python. VCL and FireMonkey (FMX) are mature GUI libraries. VCL is focused on native Windows development, while FireMonkey brings a powerful flexible GUI framework to Windows, Linux, macOS, and even Android. This webinar will introduce you to these new free Python modules and how you can use them to build graphical users interfaces with Python. Part 2 will show you how to target Android GUI applications with Python!
Slides download as PDF
Table of Contents
Target Audience
- 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?
● Set of free Python modules bringing Delphi’s GUI libraries to Python developers
● Based on the open source Python4Delphi (same technology that powers PyScripter)
● Available today on GitHub & PyPi
● Currently in beta, but ready for use
● DelphiVCL for Python supports Windows (32-bit & 64-bit)
● DelphiFMX for Python adds support for Linux 64-bit, Android, & Mac OS
● Part of a bidirectional bridge between Delphi and Python
Timeline for Delphi & Python
Delphi’s DNA
- Developer productivity – Really the main goal is getting things done quickly
- Maintainability – Code is easy to read and understand with good encapsulation
- Fast compiled native apps – Compiles fast, and native applications run fast
- Database access – Always includes a rich set of database access components
- Platform API access – You don’t need to call platform APIs, but can if you want
- Property-Method-Event – General model for working with components
- Visual designers – WYSIWYG with drag and drop interface
- Reliable applications – Exception handling and component owner model
- Backwards compatibility – Even with all the updates most code is compatible
- 10.Rich component ecosystem – There is usually a component for everything
Zen of Python
19 “guiding principles” that influence the design of the Python programming language
Comparison (Delphi – Python)
Three Levels of Development (Universal to all development tools)
VCL (Visual Component Library for Microsoft Windows)
● Designed for Windows and evolving with each new Windows release supporting latest features, controls, themes, and design
● Full source ships with each release since Delphi 1
● Mostly a light wrapper around the native platform widgets and controls
● Includes a lot of “owner drawn” controls too
● Provides easy access to Windows Handles, Messages, etc.
● Greatly simplifies Windows development maintaining access to all platform features and APIs
● Native Windows look and feel with full theme system
● Mature platform with rich ecosystem of 3rd party components
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
● Similar to VCL, but not designed to be compatible
● 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 (nestable)
Short Delphi Tour
- Delphi isn’t required to use the Delphi for Python modules
- The IDE runs on Windows, but targets other platforms
- There are multiple editions and options to get started
- Free options – 30-day trial of RAD Studio Enterprise / Community Edition (some limitations apply)
- Three paid editions – Professional, Enterprise, and Architect
- Note: RAD Studio includes Delphi and C++Builder
- Find out more embarcadero.com/products/delphi
Delphi for Python
Delphi VCL for Python Installation
- Supports – Win32 & Win64 x86 architectures / Python cp3.6, cp3.7, cp3.8, cp3.9 and cp3.10
- Conda support – Win x86 and x64 from Python cp3.6 to cp3.10
- Install via pip: pip install delphivcl
- Details and downloads
Hello World (The simplest example)
Example with Styles
- Activity Indicator sample with option to load and change styles
- github.com/Embarcadero/DelphiVCL4Python/tree/main/samples/ActivityIndicator
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
- Requires no Object Pascal knowledge
- Still write all your code in Python
- Just right-click and export with the DelphiVCL4Python IDE add-in
Combine Delphi and Python
- The Python4Delphi library is a bidirectional bridge
- Develop parts of your solution in Delphi, and part in Python
- Play to the strengths of each
- Merge them together into a single cohesive solution
- Find samples, tutorials, and videos
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
- Main Delphi documentation
- Library Reference
- Delphi prefixes type names with a “T”
- TEdit in Delphi is an Edit in Python
- It is just a naming convention
About PyScripter
- Popular free & 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 local and remote Python debugging
- Integration with Python tools like PyLint, TabNanny, Profile, etc.
- Run or debug files from memory.
About UltraEdit
- High performance text editor for programmers.
- Industry’s best large file handling: 10+ GB and beyond.
- Syntax highlighting for nearly any language or data format.
- Smart templates.
- Hex editing. Column / block mode editing.
- Part of Idera family of developer tools.
Next Steps
- Install Delphi VCL for Python github.com/Embarcadero/DelphiVCL4Python
- Star the repository, see the samples, file issues, and make feature requests
- Read the blog post (links, replays) blogs.embarcadero.com/?p=128183
- Join part 2 on FMX & Android https://embt.co/d4p-part2
- Jan 26th at 9 AM CST (Same registration as Part 1)
- Start a 30-day Delphi trial embarcadero.com/products/delphi/start-for-free
- Subscribe on YouTube youtube.com/c/EmbarcaderoTechnologies
- Follow us on Twitter twitter.com/embarcaderotech
- Like us on Facebook facebook.com/embarcaderotech
- Follow us on LinkedIn linkedin.com/company/embarcadero-technologies
- Read our blog pythongui.org