omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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

    Pythonista
    4
    11
    5964
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • chriswilson
      chriswilson last edited by

      Are the attributes of the scene.Rect class not x, y, width and height (without parentheses as they are attributes, not methods)?

      Phuket2 1 Reply Last reply Reply Quote 1
      • Phuket2
        Phuket2 @chriswilson last edited by

        @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.

        1 Reply Last reply Reply Quote 1
        • chriswilson
          chriswilson last edited by

          @Phuket2
          Yeah I wondered if it might be a different module. Im only really familiar with scene.Rect()!

          1 Reply Last reply Reply Quote 0
          • ccc
            ccc last edited by

            import scene, ui
            print(scene.Rect() == ui.Rect())  # True
            print(scene.Rect == ui.Rect)      # True
            print(scene.Rect is ui.Rect)      # True
            
            1 Reply Last reply Reply Quote 1
            • amdescombes
              amdescombes last edited by

              Where these methods removed? Is there any reason this was done?

              1 Reply Last reply Reply Quote 0
              • chriswilson
                chriswilson last edited by

                @amdescombes
                I'm not sure actually. I didn't know those attributes had been available.

                amdescombes 1 Reply Last reply Reply Quote 0
                • amdescombes
                  amdescombes last edited by

                  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()
                  Phuket2 1 Reply Last reply Reply Quote 0
                  • Phuket2
                    Phuket2 @amdescombes last edited by

                    @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.

                    1 Reply Last reply Reply Quote 0
                    • amdescombes
                      amdescombes @chriswilson last edited by

                      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

                      1 Reply Last reply Reply Quote 0
                      • ccc
                        ccc last edited by

                        @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.

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post
                        Powered by NodeBB Forums | Contributors