• Oscar

    A quick google search found me this:
    Detection between a circle and a line

    Should be a good start.

    posted in Pythonista read more
  • Oscar

    @ccc It looks nice. Just checking to see that I've understood this... It is a way to check out the files from a git repo into Pythonista. And Working Copy itself can keep the files in sync between iOS devices. But getting changes of the files out of Pythonista is not covered by this solution. Do you copy-paste the changes into Working Copy manually?

    How do you use it yourself?

    posted in Pythonista read more
  • Oscar

    I was wondering about the current state of OpenGL/GLES/GLKit support for Pythonista (3). Between numpy and objc_util I guess the possibilities are there.

    posted in Pythonista read more
  • Oscar

    @bennr01 Thanks for the clarification and the links. It is unfortunate that syncing between your own devices can't be built in because of this.

    posted in Pythonista read more
  • Oscar

    I'm not sure that a built in Dropbox sync feature would not be allowed by Apple. If Editorial already syncs scripts it seems ok. Apple is trying to prevent people from building app stores in apps as well as trying to protect people from running potentially bad programs.

    I understand why the "Open in.." feature was not allowed by Apple considering their policies, but that is a different thing.

    Syncing your own Python programs between your devices with Dropbox might not be a problem.

    posted in Pythonista read more
  • Oscar

    I was wondering the exact same thing as @Omega0 did two years ago. Since the documentation has not yet been updated it's great to have this forum and that it is easy to search.

    posted in Pythonista read more
  • Oscar

    Not only is Pythonista amazing, the level of support is equally crazy! Thank you @omz.

    ObjC is nifty for all sorts of things.

    posted in Pythonista read more
  • Oscar

    I've looked but I can't find anything about this. Does anyone know if there is a way to disable the on screen printing in a Scene/SceneView?

    I'm referring to this: For debugging purposes, a SceneView will show standard output and exceptions in a “status line” at the bottom, so you can use print statements during development, even if your scene covers the whole screen.

    (Actually this is only documented in SceneView, even though the feature is available when using Scene.run() to show a Scene. )

    Sometimes printing stuff when running a script is useful, even when you don't want to see it directly on screen.

    posted in Pythonista read more
  • Oscar

    I don't know if it is related, but I am encountering a crash with a very similar piece of code, but not for code completion. This crashes when it is run:

    # coding: utf-8
    
    from scene import *
    import sound
    import random
    import math
    A = Action
    
    class MyScene (Scene):
        def setup(self):
                    #Does not crash 
            SpriteNode('emj:Airplane', position=self.size/2, parent=self)
                    # Will crash
            SpriteNode('iow:alert_256', position=self.size/2, parent=self)
    
    if __name__ == '__main__':
        run(MyScene(), show_fps=False)
    

    It's always crashing for me on Python 2.1, but not on Python 3.0. I assumed it had to do with some of the built-in image collections somehow.

    posted in Pythonista read more
  • Oscar

    On the donation/financial contribution topic. I can understand that @omz feels uncomfortable taking donations, this brings notions of charity. But me and many other are more than willing to contribute financially to the apps, to show appreciation for this wonderful tool and to help with/speed up future development. If there would be an anti-sale day for the new Python 3 version with a higher price (5x?) I would buy it that day.

    posted in Pythonista read more
  • Oscar

    @AtomBombed If you post code from your failed attempt I am sure someone will help you out. Without the specifics of the situation I can only give you the hint that math.atan2() is a very handy function.

    posted in Pythonista read more
  • Oscar

    A unary minus for the Vector2 class would have been nice:

    >>> import scene
    >>> v = scene.Vector2(1, 2)
    >>> v * -1
    Vector2(-1.00, -2.00)
    >>> -v
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    TypeError: bad operand type for unary -
    

    And the next beta build linked against the GameController network. We can test if it solves the problem by using the objc module.

    posted in Pythonista read more
  • Oscar

    The list of points in your example is not strictly a list, it is a tuple of tuples.

    I haven't tried it myself, but does triangle_strip([(0,0),(10,0),(0,10)]) work?

    posted in Pythonista read more
  • Oscar

    I think that right now the way to do it is using a PathNode. The old way of doing explicit drawing is not very efficient.

    Edit: I meant ShapeNode when I wrote PathNode...

    posted in Pythonista read more
  • Oscar

    Not the most straight forward bit of Code, but it works:

    def draw(self):
        with ui.ImageContext(200, 200) as ctx:
            path = ui.Path()
            path.move_to(180, 100)
            path.add_arc(100, 100,  80, 0, radians(170))
            path.line_width = 5
            ui.set_color('blue')
            path.stroke()
            ui_image = ctx.get_image()
        pil_image = Image.open(io.BytesIO(ui_image.to_png()))
        scene_image = load_pil_image(pil_image)
        image(scene_image)

    posted in Pythonista read more
  • Oscar

    I think there has been some discussion before where you can use ImageContext.get_image() to make an image and then use that one in the (pre 2.0) Scene? Perhaps you have to save it to file in between.

    Ohh. Actually this might be the way to use a PIL image with the old scene drawing: scene_drawing.load_pil_image()

    posted in Pythonista read more
  • Oscar

    I don't have a complete answer, but I guess that Path.add_arc is what you are looking for.

    posted in Pythonista read more
  • Oscar

    Try 1.0 instead of 255. The rgba values are 0.0-1.0, not 0-255.

    posted in General Discussion read more
  • Oscar

    Yes, the Code is for the new Scene module. For the current version of Pyhonista the old MultiScene solution works very well.

    posted in Pythonista read more
  • Oscar

    @Cethric Yes, I made sure that the Controller was listed as connected in Settings, and that I could use it in another app.

    I've looked around to find out if Game Controller support needs to be declared in the app plist. It seems to be true for tvOS apps, but I can't find anything about that for iOS. It would explain the behavior though.

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!