How to convert String to integer

Asked by Gabriel.Amaral

I am using the function text() to to take some numbers from the screen. The problem is that text goes to a string and I need to do some manipulations with the numbers.
Is There any way to convert a string to integer or take directly in integer format from the screen?

Question information

Language:
English Edit question
Status:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
Last query:
Last reply:
Revision history for this message
Best RaiMan (raimund-hocke) said :
#1

number = int(region.text())

Revision history for this message
obiwan-92 (obiwan-92) said :
#2

Hi !

Nothing to add to the RaiMan answer, but, if I was you, I will secure the code :
try:
    number = int(region.text())
except ValueError, err:
    print "Error : ", err

Regards.

Revision history for this message
Gabriel.Amaral (gabriel0607) said :
#3

Thanks RaiMan, that solved my question.