[request] want additional method signature Region.inside(left, right, top, bottom)

Bug #702291 reported by RaiMan
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
SikuliX
Fix Released
Critical
RaiMan

Bug Description

especially, when trying to use Region.text() optimally, I found the following helper very convenient (I have it in my basics):

def regInside(reg, left, right, top=0, bottom=0):
    return Region(reg.x+left, reg.y+top, reg.w-left-right, reg.h-top-bottom)

This returns a new region inside the given one, with some padding left, right, top, bottom.

It would be helpful to have it as a Region method
def inside(reg, left, right, top=0, bottom=0):

the defaults for top and bottom: I found that it is mostly helpful to cut the region horizontally and keep the height.

e.g.
App.focus("Safari") # supposing Safari is running and shows a webpage
win = App.focusedWindow()
titleText = win.above(1).below(25).inside(70, 40).text()

so inside() helps to cut off the parts of the titlebar containing grafics.

Tags: fkt-region
RaiMan (raimund-hocke)
Changed in sikuli:
importance: Undecided → Wishlist
Revision history for this message
Shienarier (shienarier) wrote :

It would be nice is the syntax could be like this:
NewRegion = OldRegion.getSubRegion(50, 50, 50, 50)

RaiMan (raimund-hocke)
Changed in sikuli:
status: New → Fix Committed
importance: Wishlist → Critical
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → x1.0
RaiMan (raimund-hocke)
tags: added: fkt-region
RaiMan (raimund-hocke)
Changed in sikuli:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.