forked from UmSenhorQualquer/pyforms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPersonWindow.py
More file actions
47 lines (35 loc) · 1.61 KB
/
Copy pathPersonWindow.py
File metadata and controls
47 lines (35 loc) · 1.61 KB
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
43
44
45
46
47
import pyforms
from pyforms import BaseWidget
from pyforms.Controls import ControlText
from pyforms.Controls import ControlButton
from Person import Person
class PersonWindow(Person, BaseWidget):
def __init__(self):
Person.__init__(self, '', '', '')
BaseWidget.__init__(self,'Person window')
self.parent = None
#Definition of the forms fields
self._firstnameField = ControlText('First name')
self._middlenameField = ControlText('Middle name')
self._lastnameField = ControlText('Lastname name')
self._fullnameField = ControlText('Full name')
self._buttonField = ControlButton('Press this button')
#Define the button action
self._buttonField.value = self.buttonAction
self._formset = ['_firstnameField', '_middlenameField', '_lastnameField',
'_fullnameField',
(' ','_buttonField', ' '), ' ']
def buttonAction(self):
self._firstName = self._firstnameField.value
self._middleName = self._middlenameField.value
self._lastName = self._lastnameField.value
self._fullnameField.value = self.fullName
#In case the window has a parent
if self.parent!=None: self.parent.addPerson(self)
def printFullName(self):
print( self._fullnameField.value)
##################################################################################################################
##################################################################################################################
##################################################################################################################
#Execute the application
if __name__ == "__main__": pyforms.startApp( PersonWindow )