Python On Android: With Delphi FMX
Python On Android: With Delphi FMX
Android
with Delphi FMX
The Cross Platform GUI Framework
Part 2
Jim McKeeth
Chief Developer Advocate
Embarcadero Technologies
jim.mckeeth@embarcadero.com
@JimMcKeeth
Visual Component
Delphi VCL
Library (VCL)
for Python
An interpreted high-level A compiled general-purpose
general-purpose programming stack (IDE +
programming language. Compiler + Libraries)
Introduced in 1991 as the Delphi FMX FireMonkey introduced in 1995 as the
successor to ABC. for Python (FMX) successor to Turbo Pascal.
Delphi Library for
Windows GUI
development
Python module for
Windows GUI development. Python4Delphi
Open-source bidirectional
bridge combining Delphi
and Python
Open source.
Free to use, Free and
modify, and commercial
redistribute. licenses with
source.
● Windows 32-bit and 64-bit only ● Uses GPU for custom rendering
● Windows 8.1 through Windows 11 ● Multi-platform for Windows, Linux,
○ (Earlier versions may work, but not supported.) Android, and Mac OS
● Based on native Windows components ● Higher level of abstraction
● Includes Windows Handles, Messages, ● Platform services simplifies behaviors
Accessibility, etc.
● Styling system
● Styling system
● Conda support:
○ Win x86 and x64 from Python cp3.6 to cp3.10
○ Linux x86_64 from Python cp3.7 to cp3.9 (Recommended!)
○ macOS not supported yet
● Details and downloads
○ github.com/Embarcadero/DelphiFMX4Python
○ pypi.org/project/delphifmx/
Application.MainForm = Form(Application)
Configure the form
Application.MainForm.SetProps(Caption = "Hello World")
msg = Label(Application.MainForm)
msg.SetProps(Parent = Application.MainForm, Create and configure the label
Text = "Hello Python from Delphi FMX",
Position = Position(PointF(20, 20)),
Width = 200)
Application.MainForm.Show()
Show the form and start the
Application.Run() # This is the main loop main loop
Application.MainForm.Destroy()
https://github.com/Embarcadero/DelphiFMX4Python/blob/main/samples/Simplest.py
self.hello = Label(self)
self.hello.SetProps(Parent = self,
Text = "Hello Python from Delphi FMX",
Position = Position(PointF(20, 20)), Width = 200)
self.clickme = Button(self)
self.clickme.SetProps(Parent = self, Text = "Click Me",
Position = Position(PointF(20, 50)), OnClick = self.__button_click) Button has an event handler assigned
def main():
Application.Initialize()
Application.Title = "Hello Delphi FMX"
Application.MainForm = HelloForm(Application) Show the form and start the
Application.MainForm.Show() main loop
Application.Run()
Application.MainForm.Destroy()
if __name__ == '__main__':
main()
https://github.com/Embarcadero/DelphiFMX4Python/blob/main/samples/HelloDelphiFMX.py
self.hello = Label(self)
self.hello.SetProps(Parent = self, Text = "Next Do: ", Position = Position(PointF(20, 20)))
self.edit = Edit(self)
self.edit.SetProps(Parent = self, Position = Position(PointF(80,18)))
self.clickme = Button(self)
self.clickme.SetProps(Parent = self, Text = "Add",
Position = Position(PointF(190, 18)), Width = 80, OnClick = self.__button_click)
self.list = ListBox(self)
self.list.SetProps(Parent = self, Position = Position(PointF(20, 60)), Width = 250, OnClick = self.__list_item_click)
Embarcadero is working on a
free style bundle for Python
https://github.com/Embarcadero/DelphiFMX4Python/tree/main/samples/ControlsDesktop
Exploring the
Delphi for Python
Bridge
Q&A
Jim McKeeth
Chief Developer Advocate
Embarcadero Technologies
jim.mckeeth@embarcadero.com
@JimMcKeeth