-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathHelloDelphiFMX.py
42 lines (33 loc) · 1.29 KB
/
HelloDelphiFMX.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#----------------------------------------------------------------
# Name: HelloDelphiFMX.py
# Purpose: Simple DelphiFMX for Python demonstration with OOP
#
# Author: Jim McKeeth
#
# Created: 21/01/2022
# Copyright: (c) Embarcadero Technologies 2022
#----------------------------------------------------------------
from delphifmx import *
class HelloForm(Form):
def __init__(self, owner):
self.SetProps(Caption = "Hello Python",
Position = "ScreenCenter", OnShow = self.__form_show)
self.hello = Label(self)
self.hello.SetProps(Parent = self, width = 200,
Text = "Hello Python from Delphi FMX", Position = Position(PointF(20, 20)))
self.clickme = Button(self)
self.clickme.SetProps(Parent = self, Text = "Click Me",
Position = Position(PointF(20, 50)), OnClick = self.__button_click)
def __form_show(self, sender):
self.SetProps(Width = 300, Height = 400)
def __button_click(self, sender):
self.hello.Text = "Thanks!"
def main():
Application.Initialize()
Application.Title = "Hello Delphi FMX"
Application.MainForm = HelloForm(Application)
Application.MainForm.Show()
Application.Run()
Application.MainForm.Destroy()
if __name__ == '__main__':
main()