-
Notifications
You must be signed in to change notification settings - Fork 25
/
crud.pyw
60 lines (44 loc) · 2.28 KB
/
crud.pyw
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
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/python
# -*- coding: utf-8 -*-
"Experimental CRUD sample gui2py application demo"
__author__ = "Mariano Reingart ([email protected])"
__copyright__ = "Copyright (C) 2015- Mariano Reingart"
__license__ = "LGPL 3.0"
import datetime
import decimal
import os
# disable ubuntu unified menu
os.environ['UBUNTU_MENUPROXY'] = '0'
import gui
# --- gui2py designer generated code starts ---
with gui.Window(name='mywin', title=u'gui2py CRUD demo', resizable=True,
height='585px', left='180', sizer='wrap', top='24',
width='327px', bgcolor=u'#E0E0E0', image='', tiled=True, ):
with gui.Panel(name='panel', sizer='wrap', width="100%", height="100%"):
gui.Label(name='label_140_120', sizer_align='center', sizer_border=4,
width='100%', text=u'Sample Record', )
with gui.Panel(label=u'', name='record', sizer='gridbag', width='100%',
image='', sizer_border=5):
gui.Label(name='l_id', width='100px', text=u'ID', )
gui.TextBox(name='id', sizer_col=1, text=u'1234', value=u'1234', )
gui.Label(name='_name', sizer_row=1, text=u'Name', )
gui.TextBox(name='name', sizer_col=1, sizer_row=1,
sizer_expand=True, text=u'Mariano', value=u'Mariano', )
gui.Label(name='_address', sizer_row=2, text=u'Address', )
gui.TextBox(name='address', sizer_col=1, sizer_row=2,
text=u'Argentina', value=u'Argentina', )
gui.Button(label=u'Create', name='create', sizer_border=4, )
gui.Button(label=u'Retrieve', name='retrieve', sizer_border=4, )
gui.Button(label=u'Update', name='update', sizer_border=4, )
gui.Button(label=u'Delete', name='delete', sizer_border=4, )
gui.Button(label=u'Search', name='search', sizer_border=4, )
# --- gui2py designer generated code ends ---
mywin = gui.get("mywin")
mywin['panel']['record'].set_sizer_grow_col(1, 1)
if __name__ == "__main__":
# example to add programmatically a field (controls) at runtime
with mywin['panel']['record']:
gui.Label(name='l_zid', sizer_row=3, sizer_col=0, text=u'ID', )
gui.TextBox(name='zip', sizer_row=3, sizer_col=1, value=u'1688', )
mywin.show()
gui.main_loop()