[2.0.4] Region methods getRow and getCol does not work --- fixed in 2.0.5

Asked by TestMechanic

Seems like getRow and getCol methods does not work

tested with sikuli 2.0.4

reg = getRow(3,4)

Above code always select the whole screen

Question information

English Edit question
SikuliX Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
masuo (masuo-ohara) said :

I've also noticed before that getRow and getCol don't work with two arguments.
When I need them, I am using setRaster.

r = Region(100,100,600,200)
for row in range(0,MAXROWS):
    for col in range(0,MAXCOLUMNS):

Revision history for this message
Simon Plivav (simpliv742) said :

reg = getRow(3,4)

What you wrote is bad style, or even not functional. What is your intention, to get a cell or a row?

[Below reg = Region(something, e.g. SCREEN)]

You should provide a region that is having rows set up by reg.setRows(3). Then get a row as row=reg.getRow(2)

With two arguments like you tried you should have used reg.setRaster(x, y), then you can select cells of that raster like reg.getCell(2,2).

Revision history for this message
TestMechanic (ndinev) said :

I am using it correctly according to the documentation

getRow(3,4) > means to divide screen(default) in 4 rows and get the forth one (it is zero based 0,1,2,3)

Here is the excerpt from documentation

If you need only one row in one column with x rows or only one column in one row with x columns you can use Region.getRow() or Region.getCol()

getRow(whichRow, numberRows)

        numberRows – in how many evenly sized rows should the region be devided
        whichRow – the row to select counting from 0, negative counts backwards from the end


    a new Region created from the selected row

Revision history for this message
RaiMan (raimund-hocke) said :

LOL, should have checked a bit earlier :-((

You are completely right.

... but it is not implemented - simply returns the actual region - really sorry.

getCols(I, n) works as documented.

I will fix it in 2.0.5.

setRows(4); getRow(3)

Can you help with this problem?

Provide an answer of your own, or ask TestMechanic for more information if necessary.

To post a message you must log in.