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

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:

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.

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

Look, dinilkarun. This is not the first time you have provided to little information. If you want answers that help you really need to put in the effort. What is this grid? Is it in wxPython, Tkinker, pyQT or something? Cause unless we know that we cant do anything.

Try harder and you'll find it pays off in better answers

This article has been dead for over six months. Start a new discussion instead.