-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcss_stylesheets.py
33 lines (27 loc) · 1.27 KB
/
css_stylesheets.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
'''
Usage example of pyforms library.
This example illustrates how to use css on your pyforms gui components.
This scripts reads the file styles/styles.css and applies the loaded stylesheet to the GUI. To indicate pyforms where
to read the stylesheet css file, you must create your local_settings.py file in your working directory and set
the config variable PYFORMS_STYLESHEET
Another way (used on this example) is to define your settings in any place (config/css_settings.py) and load configuration
before starting the app using the conf object from the confapp module
'''
import pyforms
from pyforms.controls import ControlText, ControlLabel, ControlTextArea, ControlButton
from pyforms.basewidget import BaseWidget
from confapp import conf
class Foo(BaseWidget):
def __init__(self):
super().__init__()
self.name = ControlText('Name: ')
self.surname = ControlText('Surname: ')
self.address = ControlText('Address: ')
self.description = ControlTextArea('Write your issue here: ')
self.submit = ControlButton('Submit')
self.formset = [
'name', 'surname', 'address', 'description', '=', 'submit'
]
if __name__ == '__main__':
conf += 'css_settings'
app = pyforms.start_app(Foo, geometry=(300, 300, 300, 300))