python - How to restrict user input in QLineEdit in pyqt -
i have qlineedit
, want restrict qlineedit
accept integers. should work inputmask. dont want use inputmask
, because if user clicks on qlineedit
cursor @ position mouse clicked. , user need navigate 0 position , type eve wants.
is there alternate this.
you can use exception handling validating this:
number = self.ui.number_lineedit.text() try: number = int(number) except exception: qtgui.qmessagebox.about(self, 'error','input can number') pass
you can use validators validate input strings.
Comments
Post a Comment