Im trying to reuse predefined regions but I get Nonetype error when assigning it to a new variable using sikuli.setW()
. Here's my code:
import math
import sikuli
self.screen_reg = sikuli.Screen(0)
self.monitor_reg = self.screen_reg
self.leftreg = sikuli.Region(
self.monitor_reg.x,
self.monitor_reg.y,
int(math.floor(self.monitor_reg.w/2)),
self.monitor_reg.h)
self.rightreg = sikuli.Region(
self.monitor_reg.x + int(math.floor(self.monitor_reg.w/2)),
self.monitor_reg.y,
int(math.floor(self.monitor_reg.w/2)),
self.monitor_reg.h)
self.leftreg.highlight(3) <=== working
self.quarter = self.leftreg.setW(int(math.floor(self.leftreg.w/2)))
self.quarter.highlight(3) <====== didnt work;
error: NoneType object has no attribute highlight
If I print type(quarter)
, it returns NoneType
.
If I change it into these:
self.leftreg.highlight(3)
self.leftreg.setW(int(math.floor(self.leftreg.w/2)))
self.leftreg.highlight(3)
It works fine. What am I missing? Thanks for the help.