| | |
Text entered in a grid cell should be numeric
![]() |
I'm not entirely sure what you mean by a 'grid', but if you only want to accept numeric input, you can use a function like this to return it:
As for the second part of your question, I'm not fully sure what that 'grid' is, so can you elaborate on it or show some code please? Thanks.
python Syntax (Toggle Plain Text)
def getNum(): while True: n = raw_input('Enter a number:') try: n = float(n) # or int(n) if you want an integer return n except: print 'Enter a number!'
As for the second part of your question, I'm not fully sure what that 'grid' is, so can you elaborate on it or show some code please? Thanks.
"Two good old boys in a fire-apple red convertible. Stoned. Ripped. Twisted. Good people."
- Hunter S. Thompson
my photography
- Hunter S. Thompson
my photography
•
•
•
•
Hi All,
I have created a grid and want to implement the following idea:
The user should be able to enter only numeric values in any of the cells in that grid.
I could not get any property of the cell which can check for the entered data.
Please guide as for achieving this.
Thanks,
Dinil
Try harder and you'll find it pays off in better answers
Make it idiot proof and someone will make a better idiot.
Check out my Site | and join us on IRC | Python Specific IRC
Check out my Site | and join us on IRC | Python Specific IRC
![]() |
Similar Threads
- checking input data using checkinput() function (Visual Basic 4 / 5 / 6)
- formatting text (VB.NET)
- How to detect a click in a grid cell? (Python)
- Limit Text box input (VB.NET)
- Table width (HTML and CSS)
- Setting the focus to a specific text box and other woes (C#)
- Cursor control in text boxes: (HTML and CSS)
- refresh datagrid causes error if oper scrolled off right side of grid (VB.NET)
- How do you center the text in a JTextField?? (Java)
- chars and floats (C)
Other Threads in the Python Forum
- Previous Thread: Help needed: String to Dictionary conversion
- Next Thread: Text entered in a grid cell should be numeric
| Thread Tools | Search this Thread |
abrupt alarm ansi anti approximation assignment avogadro backend beginner binary bluetooth calculator character cmd code customdialog cx-freeze data decimals dictionaries dictionary directory dynamic error examples exe file float format function gnu graphics gui halp heads homework http ideas import input java launcher leftmouse line linux list lists loop module mouse number numbers output parsing path pointer port prime programming progressbar projects push py2exe pygame pyglet pyqt python random recursion schedule screensaverloopinactive script scrolledtext sqlite statistics string strings sudokusolver sum table terminal text thread threading time tlapse tricks tuple tutorial twoup ubuntu unicode urllib urllib2 variable ventrilo wikipedia write wxpython xlib





