Event functions do not recognize str.isdigit method
almarklein opened this issue · 0 comments
almarklein commented
@apdd2003 commented on Thu Mar 01 2018
Event functions do not recognize python functions, but works with Javascript functions (commented in code):
error: "JS: TypeError: amountstr.isdigit is not a function"
from flexx import app, event, ui
class Example(ui.Widget):
def init(self):
with ui.FormLayout():
ui.Widget(flex=.2)
self.t1 = ui.LineEdit(title='Amount:',style='width:30%;')
ui.Widget(flex=.2)
self.l2 = ui.Label(title='Note:')
ui.Widget(flex=3)
@event.reaction('!t1.myblurevent')
def _lineEdit_events(self, *events):
ev = events[-1]
amountstr=self.t1.text
if (amountstr.isdigit()):
self.l2.set_text('Py: Number')
else:
self.l2.set_text('Py: Not Number')
# if(Number.isInteger(int(amountstr))):
# self.l2.set_text('JS: Number')
# else:
# self.l2.set_text('JS: Not number')
app.launch(Example)
app.run()