• Moe

    My current approach is to load the tileset.png which contains all the tiles. I then use Image.crop() for every tile I want to extract. I then upscale them using Image.resize() by some arbitrary factor, because if I would let the scene upscale the 8x8 textures to something like 64x64, the performance drops hard. Using BytesIO I convert them to ui.Image without saving them on disk and from there I can load them as a scene.Texture.

    But thank you for the hint that I can load the image and scale them in one operation!

    All I had to do to fix the original problem was converting the tileset.png to RGB mode.

    posted in Pythonista read more
  • Moe

    I found the problem: The images I used For testing where saved in P / Indexed Color mode. This can be checked with PIL

    from PIL import Image
    
    img = Image.open('sprite.png')
    print(img.mode)
    #> 'P'
    

    I converted them with img = img.convert('RGB') and saved them again. Now it works. It seems that the Texture class cannot handle files in mode P and does not fail gracefully. This is probably an oversight.
    Thank you again @cvp for taking your time to help! Much appreciated.

    posted in Pythonista read more
  • Moe

    I now imported a photo I took with the iPad (JPG) via the little plus in the bottom left -> Import... -> Photo Library and it worked fine!

    Maybe there is a problem using PNGs?

    posted in Pythonista read more
  • Moe

    After testing with a bigger image (overworld_tileset.png, 565x564 px, 44kb) I got the same result.
    Restarting Pythonista did not help, restarting the iPad did not help.

    posted in Pythonista read more
  • Moe

    Thanks for the suggestion, but the image is in the same directory. It is really odd that it does work for you, but not for me.

    I am on iOS 13.5 (17F75) with an iPad 7 and Pythonista 3.3 (330025)

    posted in Pythonista read more
  • Moe

    Hi, I am trying to build a scene with custom textures, which I pre-process using PIL. From PIL I then convert them to ui.Image and then I want to load them as a Texture. Unfortunately, I cannot get them to load at all. Included is a minimum (non-) working example with a normal png in my project directory.

    import ui, scene
    
    image = ui.Image('sprite.png')
    image.show()    # this works
    texture = scene.Texture(image) # this fails
    '''
    Traceback (most recent call last):
      File "/private/var/mobile/Containers/Shared/AppGroup/73760516-2464-4322-8DCC-0525D46DFFC3/Pythonista3/Documents/smw/minimal_example.py", line 5, in <module>
        texture = scene.Texture(image)
    ValueError: Could not load image
    '''
    
    texture = scene.Texture('sprite.png') # this fails as well
    '''
    Traceback (most recent call last):
      File "/private/var/mobile/Containers/Shared/AppGroup/73760516-2464-4322-8DCC-0525D46DFFC3/Pythonista3/Documents/smw/minimal_example.py", line 6, in <module>
        texture = scene.Texture('sprite.png')
    ValueError: Image not found
    '''
    

    The sprite.png is a 32x32 PNG with a size of 981 bytes. I had no luck getting this to work with other images so far.
    Any help is appreciated.

    posted in Pythonista read more
  • Moe

    @disorientedp Yep, because of the jailbreak I'm staying on iOS 8 for now. But I will upgrade to iOS 9, if/when Pythonista stops supporting iOS 8, just like @JonB :P

    @omz It seems to be working fine now, at least it doesn't crash when typing. If something else occurs, I'll let you know!

    posted in Pythonista read more
  • Moe

    Whenever I try to write a file, as soon as I input any character via the onscreen keyboard, Pythonista crashes. I have not tested it with a bluetooth keyboard, but I assume it has to do with the autocompletion. In the console it works fine.

    I am on an iPad mini 2 (I think it is model number is 4,4) with iOS 8.3. Also I should add that I am jailbroken.

    posted in Pythonista read more
  • Moe

    The speed of Python lies mostly in development time. Python is not the fastest language execution wise, but getting something running is A LOT faster than in comparison to C or Java.

    posted in Pythonista read more
  • Moe

    One bug I noticed is that when you press Tab in the console it will be converted to soaces, regardless of the 'soft-tabs' option.

    posted in Pythonista read more
  • Moe

    @Webmaster4o I should have put a smiley at the end of that, I just couldn't resist to be the stereotypical un-fun German :P I know that you were just kindly poiting out a mistake :)

    posted in Pythonista read more
  • Moe

    Well, there is the app template.
    You will need a Mac and an Apple developer account as well as xcode, but this allows you to package your Pythonista scripts in their own apps.

    posted in Pythonista read more
  • Moe

    @Webmaster4o said:

    @Moe *steganography ;)

    You are correct. Considering I am German and the fact that steganography is not quite commonly used, I hope you may excuse my mistake.

    posted in Pythonista read more
  • Moe

    Now to turn this into a steganography module ;)

    Edit:

    • steganography
    • bug fixes and optimisations

    posted in Pythonista read more
  • Moe

    Who needs base64 encoded images when you can have this?

    posted in Pythonista read more
  • Moe

    That's awesome! I'll definitely get that version as well, as I'll just switch to it asap :P

    posted in Pythonista read more
  • Moe

    I've run into the very same problem, unfortunately.
    https://forum.omz-software.com/topic/2107/help-with-gamecontroller-framework

    Now I can be sure that it's not my fault that it doesnt work :P

    posted in Pythonista read more
  • Moe

    I'm not very active at posting here, but a very interested reader, so I have found the notifications as my main way of browsing this forum for some time now.

    posted in Pythonista read more
  • Moe

    Bug in the scene module:

    The documentation for SpriteNode states, that a node without texture is rendered as a rectangle with the color of the color attribute. However creating a SpriteNode like this creates an error:

    node = SpriteNode(texture=None,position=(10,10),color='blue')
    
    
    TypeError: Expected Texture or image name.
    

    posted in Pythonista read more
  • Moe

    Apple usually closes the signing window (a time frame in which it will allow a certain iOS version to be installed on iDevices) for the previous iOS version shortly after a new release, but keeps it open for a while (possibly in case something like this happens: that there are compatibilitiy problems). This means you can downgrade your device to iOS 8.4.1 for now.

    To do so, you will need to download the iOS 8.4.1 .ipsw (look at ipsw.me) and the connect your device to iTunes. In the device overview in iTunes click on the "Restore" button WHILE holding the left shift button. You should be presented a explorer/finder window from where you can select the .ipsw. Just navigate to the save location and select it. Now your device should look the same as if you updated it. Just wait until it finishes and then you have iOS 8.4.1 back on yupour device.

    Note, however, that you can't use any backups from iOS versions above 8.4.1, but that should'nt be a problem, just select your most recent backup (which should be from just before upgrading to iOS 9) and you should be up and running again with your old setup.

    posted in Editorial read more
Internal error.

Oops! Looks like something went wrong!