Numerical Input - HomerHaddock/Input-API GitHub Wiki
Integers
Integers are best used for questions like "How old are you?" where a decimal is not needed.
newLineInt
newLineInt
can be used in two ways.
import inputapi as inp
# Method 1
inp.newLineInt()
# Method 2
inp.numerical.integer.newLineInt()
Parameters
Parameter | data type | default | Purpose it serves |
---|---|---|---|
request | string | "Input an integer:" |
What the user will see when the input is requested |
allowNeg | boolean | True |
Determines if the user can give a negative number |
min | integer | No limit | What is the lowest number allowed |
max | integer | No limit | What is the highest number allowed |
clearOnLoad | boolean | False |
When the function is run, should the terminal be cleared |
clearWhenDone | boolean | False |
When the input is retrieved, should the terminal be cleared |
sameLineInt
This input has only one way of being used.
import inputapi as inp
inp.numerical.integer.sameLineInt()
Parameters
Parameter | data type | default | Purpose it serves |
---|---|---|---|
request | string | "Integer=" |
What the user will see when the input is requested |
allowNeg | boolean | True |
Determines if the user can give a negative number |
min | integer | No limit | What is the lowest number allowed |
max | integer | No limit | What is the highest number allowed |
clearOnLoad | boolean | False |
When the function is run, should the terminal be cleared |
clearWhenDone | boolean | False |
When the input is retrieved, should the terminal be cleared |
Floating Point (Decimal)
Floating point input is great for accuracy (e.g. distance).
newLineFloat
Here is how you can use newLineFloat
in Python.
import inputapi as inp
# Method 1
inp.newLineFloat()
# Method 2
inp.numerical.float.newLineFloat()
Parameters
Parameter | data type | default | Purpose it serves |
---|---|---|---|
request | string | "Input an floating point number (Decimal):" |
What the user will see when the input is requested |
allowNeg | boolean | True |
Determines if the user can give a negative number |
min | integer | No limit | What is the lowest number allowed |
max | integer | No limit | What is the highest number allowed |
clearOnLoad | boolean | False |
When the function is run, should the terminal be cleared |
clearWhenDone | boolean | False |
When the input is retrieved, should the terminal be cleared |
sameLineFloat
Only one way to use sameLineFloat
.
import inputapi as inp
inp.numerical.float.sameLineFloat()
Parameters
Parameter | data type | default | Purpose it serves |
---|---|---|---|
request | string | "Decimal=" |
What the user will see when the input is requested |
allowNeg | boolean | True |
Determines if the user can give a negative number |
min | integer | No limit | What is the lowest number allowed |
max | integer | No limit | What is the highest number allowed |
clearOnLoad | boolean | False |
When the function is run, should the terminal be cleared |
clearWhenDone | boolean | False |
When the input is retrieved, should the terminal be cleared |