Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Pythonista 3 Rect attributes
-
Hi,
I've started using Pythonista and really love it but since moving to Pythonista 3 some of the scripts I was using stopped working :
I get a message saying Rect objects have no attribute left(), right(), top() or bottom(), is there anyway around this?
Thanks for any help.Cheers
Andre -
Are the attributes of the
scene.Rect
class notx
,y
,width
andheight
(without parentheses as they are attributes, not methods)? -
@chriswilson , I am sure you are right. I was going to reply to this one, but I thought maybe he was using a module that I don't use. I don't use scene, but ui.Rect() is the same. Only properties and no left, top methods or properties etc. x, y notation.
print(dir(ui.Rect()) or print dir(scene.Rect()) is the same. -
@Phuket2
Yeah I wondered if it might be a different module. Im only really familiar withscene.Rect()
! -
import scene, ui print(scene.Rect() == ui.Rect()) # True print(scene.Rect == ui.Rect) # True print(scene.Rect is ui.Rect) # True
-
Where these methods removed? Is there any reason this was done?
-
@amdescombes
I'm not sure actually. I didn't know those attributes had been available. -
I was going through the docs and I see that a Rect object has the following attributes :
- min_x # I guess I could use it instead of left()
- max_x # I guess I could use it instead of right()
- min_y # I guess I could use it instead of bottom()
- max_y # I guess I could use it instead of top()
-
@amdescombes , they are basically just short cuts. Very handy ones. Like max_y will be the rects.y + height. If you are doing things in a ui.ScrollView for example, the short cuts importance becomes very apparent. The .Rect also has an origin property, that could also factor into things.
-
Hi @chriswilson, I was trying to run some of the examples on github but I couldn't because I kept getting errors saying those attributes did not exist, that's what prompted my question, LOL
-
@amdescombes You might want to "open an issue" on the GitHUb repos that do not work and then watch how the owners fix their problems.