A quick google search found me this:
Detection between a circle and a line
Should be a good start.
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.
A quick google search found me this:
Detection between a circle and a line
Should be a good start.
@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?
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.
@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.
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.
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.
Not only is Pythonista amazing, the level of support is equally crazy! Thank you @omz.
ObjC is nifty for all sorts of things.
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.
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.
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.
@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.
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.
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?
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...
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)
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()
I don't have a complete answer, but I guess that Path.add_arc is what you are looking for.
Yes, the Code is for the new Scene module. For the current version of Pyhonista the old MultiScene solution works very well.
@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.
@mikael beat me to it.. I was going to suggest partial if you prefer to not use lambda: https://docs.python.org/2/library/functools.html#functools.partial