• @SmartGoat, also, I toyed with creating a webview-backed UI framework with a Python API that should have been runnable on most platforms (search for ”youey” here), but of course it is a huge amount of work and has been more or less done before – but those other projects have been abandoned, and none of them worked on Pythonista anyway.

  • @cvp Thanks it worked perfectly! And yeah I realized @JonB, now i can adjust parameters since it works. Thank you both very much :)

  • @ccb_2k18 sorry to answer so late but there is a time zone difference😇
    I've seen you posted the same question in another topic and you are right.
    Don't ask a question to only one person, and surely me, there are in this forum a lot of marvelous people, and often a lot smarter than me.

  • @ccc You're right but I did not want to improve the Python, only a way to solve the bug. Thus I added the two lines in the same style.

  • @a1ph4b3ta as adviced by @JonB

    import scene from math import pi class Game(scene.Scene): def setup(self): x = 0 while True: if x >= self.size.height: break spike = scene.SpriteNode('plf:Tile_Spikes', position=(x, self.size.height)) spike.anchor_point = (0.5,-1.0) spike.rotation = pi self.add_child(spike) #self.spikes.append(spike) x += 64 scene.run(Game())
  • Thanks, yeah makes sense. I just wondered if there was an 'official' online location, but that will certainly work for what I want.


  • Thank you so much. This is excellent.
    Really appreciate the help and the time you’ve taken to respond.
    Thanks 😄😄

  • @JonB said:

    [1, 2, 3, 4]

    I had a similar problem so I change the a to a tuple and the copied it to b. I needed to pop() from b but keep a unchanged so I can reset it to b at start over in my script

    [1, 2, 3]

  • @Cethric made a full GLKit wrapper, which might do what you want.
    In scene, you will be limited to converting each frame to .jpg by using the SceneView screen capture method, i think, since there is no way to get data out of a shader.

  • I just realised the error. It’s meant to be Rect(self.player.position.x-12, self.player.position.y-12, 24, 24) I forgot the .x on the end of position. Thanks for making me notice it!

  • Thanks, it’s working now!

  • Hi, I agree with @runjaj and understand @ahp378 point of view. I would add:

    have in mind a practical problem to solve with Pythonista (a program to calculate something, or a graphical app with keys and text fields, or a game, ...) divide the practical problem in little problems (if possible) learn to solve the little problems (before independently that is easier and then by linking them together to recreate the main big problem of point 1) by:
    a. searching for an existing piece of code that solves the little problem 'x' (a big database of Pythonista scripts is this by @tdamdouni). if the piece of code solves your problem ok, if not try to modify it by changing numerical values or easy parts (with an empirical approach, and if the piece of code is well commented, it is easier).
    b. if you can't find existing pieces of code, starting to read documentation having in mind that it could be not updated or incomplete (but it is very big).

    The best documentation could be in my opinion a big with easy to find/search feature database of common recipes/pieces of code for all Pythonista features (objc, scene, sound, location, console, etc...). The big database (the one by tdamdouni is an example) would be created and maintained by people with different curiosities and interests, in this way community could help itself about common pieces of code and without bothering the only person who maintains the Pythonista software and its big documentation (@omz).


  • @Drizzel, I was thinking about getting 100% accurate detection by first doing the rectangle intersection, and if that indicates a possible hit, then placing shape 1 on a canvas in memory, then ”deleting” the non-transparent pixels of shape 2 (also properly placed). If the end result does not equal the original, you have a hit.

  • got it. ios really has no native support for svg.
    PNG, JPG or PDF are what you will want to use.

    For single color, one option is to use a font creation tool (there are many) that let you convert your svg to a svg font, then use svg2ttf to convert to a ttf font, which can be installed systemwide, or can be loaded temporarily in app. Then, you can create images from the glyphs. Not really worth it in my opinion...

    Another option which looks promising but i have not explored yet:
    https://github.com/Kozea/CairoSVG can parse svg to produce a tree object, which then uses
    https://github.com/Kozea/cairocffi/ to convert to png. cairocffi might work without modification, or a small few, since it relies on ffi in a similar way that objc_util does, and i think the ios cairo is similar if not identical to the mac version. If not, you might also be able to use that tree to write your own output to ui.Path commands in an ui.ImageContext, and get_image provides the ui.Image.

    A final option -- convert svg to vector PDF. I believe ui.Image.from_file can read pdf. I don't know hw they compare size wise.. some programs might add a lot of garbage to a pdf, ImageMagick probably would do it well.

  • Ok thanks. Will give it a try

  • If your scene is a subview to a scrolview, it won't be directly addressable from the root scene.


    Should work, depending on what you named things..

  • https://github.com/elff1493/pyscene, still a wip

  • Great, and you both :)

  • @JonB Thank you, gonna se if I can xome up with some kind of function to be called

Internal error.

Oops! Looks like something went wrong!