In MDTextField, there is a restriction on entering only numbers, this is input_filter: "float", "int". But you can enter negative numbers
MDTextField:
id: z1_m
text:""
hint_text: "z1"
helper_text: "Число зубьев шестерни"
helper_text_mode: "on_focus"
input_filter: "float"
on_text_validate: app.prochnjst()
Expected that when the user enters a minus sign, nothing happens
CodePudding user response:
You can use try/ except:
try:
x = int(input())
assert x > 0
except AssertionError :
print("Only positives are allowed")