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.


    Creating Own Photo Library?

    Pythonista
    3
    8
    2017
    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.
    • andallfor
      andallfor last edited by

      I’m looking to make a game in Pythonista using tons of assets, which I downloaded to the files app on IOS. I’m wondering if I can add a custom photo library, so that whenever I click the “plus” button, I’ll be able to access those photos without having to put them in the current file I’m in.

      That is, is it possible to create some similar to “Platformer Art” or “Puzzle Game Art”, and use my own pictures?

      Thanks!

      cvp 1 Reply Last reply Reply Quote 0
      • cvp
        cvp @andallfor last edited by

        @andallfor Assume you have our own folder MyFolder in iCloud Drive where you store your photos, you can access those photos with path

        Path = '/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/MyFolder/photo1.jpg'
        
        1 Reply Last reply Reply Quote 0
        • andallfor
          andallfor last edited by andallfor

          @cvp
          Thanks for the reply!

          However, when ever I run it, it returns an error “cannot load texture”.

          from scene import * 
          Path = '/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/PythonistaProjects/OnScreenControls/transparentDark01.png'
          
          class test(Scene):
              def setup(self):
          	    self.testIMG = SpriteNode(Path, parent = self, position = (500, 500))
          
          run(test())
          

          I’m not sure if it is something in the code that is wrong, or what.

          My images are located in a file called “PythonistaProjects”, and in that file I have another file, called “OnScreenControls”, which contains my pictures. The “transparentDark01’ is the name of the photo that I want to add, and the png is added because the image is a png file. It doesn’t seem to matter if “png” is capitalized or not. The file is located in my iCloud Drive.

          mikael 1 Reply Last reply Reply Quote 0
          • mikael
            mikael @andallfor last edited by

            @andallfor, what do you get if you just

            open(Path, 'rb')
            

            ?

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

              @mikael
              Thanks for your post, I tried it, but it gave me an error:

              PermissionError: [Errno 1] Operation not permitted: '/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/PythonistaProjects/OnScreenControls/transparentDark01.png'
              
              cvp 1 Reply Last reply Reply Quote 0
              • cvp
                cvp @andallfor last edited by cvp

                @andallfor I've created a folder, subfolder and file as you said, in my icloud Drive and your program runs successfully.
                But my ipad mini 4 runs under ios 13 and last beta version of Pythomista. Not sure it has an impact, but..

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

                  And .PNG gives an error, thus, please, check names case

                  And try to open once your folder via external files in Pythonista files browser.

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

                    Only to prove it works

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