Easy data entry and validation.
Project description
Overview
EasyEntry enter data into a program and easily check if they are valid.
Uses dictionaries to define the properties of the data:
type: str, int, float, date, time, email, passwd and menu.
default: sets a default by pressing the return key
options: defines a list of allowed values: [‘a’, ‘b’,…]
minmax: sets minimum and maximum limits for a value: [0, 100]
required: defines the obligation or not to introduce a value: True or False
and others (See the property list).
Example:
import easyentry as ee ee.global_required = True person = {} person['name'] = {'type':'str'} person['city'] = {'type':'str', 'default':'Seville'} person['age'] = {'type':'int', 'minmax': [0,100]} person['height'] = {'type':'float'} person['bicycle'] = {'type':'str', 'options': ['y','n']} person['datetrip'] = {'type':'date', 'default': 'now'} person['email'] = {'type':'email', 'required': False} name = ee.entry('What is your name?', (person, 'name')) city = ee.entry('What city you live?', (person, 'city')) age = ee.entry('How old are you?', (person, 'age')) height = ee.entry('Height?', (person, 'height')) bicycle = ee.entry('Do you have a bicycle?', (person, 'bicycle')) datetrip = ee.entry('Date of trip?', (person, 'datetrip')) email = ee.entry('Your email address', (person, 'email'))
Password
Enter a password:
person['passwd'] = {'type':'passwd'} passwd = ee.entry('Enter password', (person, 'passwd')) repeat = ee.entry('Repeat password', (person, 'passwd')) if passwd == repeat: print(passwd)
Property list
Properties of the data types available:
str: required, options or minmax and default
int: required, options or minmax and default
float: required, options or minmax and default
date: required, options or mixmax and default:date or now
time: required, options or mixmax and default:time or now
password: required
email: required
menu: required, title, options, default, sorted and rindex
Constants
The constants are used to set the values that define the general behavior of EasyEntry:
# Message to be displayed when data is not valid: # - You can type the message in your language # - If the value is omitted, the default is the current (in English) ee.error_message = 'Invalid input, please try again' # Set format 'date' and 'time': # - Date format: '%Y-%m-%d' -> YYYY-MM-DD (default) # - Hour format: '%H:%M:%S' -> HH:MM:SS (default) ee.date_format = '%d-%m-%Y' ee.time_format = '%H:%M' # Set the type of numerical data (int and float): # - True and value = '' : var int -> return 0 # var float -> return 0.0 # - False (default) and value = '': return '' ee.strict_return = False # Establish whether it is mandatory to enter a valid value or # an empty entry (press return) is allowed # - True -> You must enter a valid value in all fields # - False -> The field can be empty (default) # The value of the 'required' property of a field overrides # the global value ee.global_required = True
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file easyentry-0.0.9.tar.gz
.
File metadata
- Download URL: easyentry-0.0.9.tar.gz
- Upload date:
- Size: 19.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39d08b8ad490a6a750661d0a39b4bef88c85313ae97640db3ce3fef579fb284d |
|
MD5 | 2c34b52b446b60c2217bdcc77b67caa5 |
|
BLAKE2b-256 | ea3b97276f0628100aa27569c30bd09c1fec0785a5713e151aa2b45fc5647f99 |
File details
Details for the file easyentry-0.0.9-py2.py3-none-any.whl
.
File metadata
- Download URL: easyentry-0.0.9-py2.py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 239aaaa0b6f68b200bf5398ff9234175d9c533873c94f2195a5977fd6ff9d137 |
|
MD5 | 1803a9f60d41b6c733eaab9df683df04 |
|
BLAKE2b-256 | 44c1e90b9a7b70f7918b95e0137f4686fb5804420e27c0c2ebdc995766c86a4a |