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.
Beta Status Update
-
I love the updates!!! especially tabs and search. Also love the purplish theme. And most of all love the improved traceback readout. And the consolidated keyboard is a great idea.
Great job OMZ you've created the premier development platform for (on) iOS!
Just an observation - the yellow dot to the left of "Pythonista" under the icon doesn't go away for me. I believe it's supposed to indicate that there's a new version of the app on your device that you haven't opened yet...but I have. Pythonista is the only app I have in test flight so forgive me if I'm wrong - either way sounds like it would be a test flight issue.
Also one gripe - if you have a script in the foreground and it runs, you can click the x in the upper right while in console view to stop it. You can't press play(run) from the same place - instead it's a greyed out x and you have to backup to the script to press play again. It wasn't like this in previous versions, and while I can see the logic in making sure you're at the script before you can run it, being able to run a script multiple times while looking at the console without backing out of it is very useful to quickly try code modifications out during development...for me at least. Perhaps a toggle for this functionality deserves to exist in settings?
Thanks again.
ALSO, since the new version I get this error all the time. Everything still works, but this error shows up in red in the console.
D96-4218-87C0-D09DA5054558/Pythonista2.app/pylib/site-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. InsecurePlatformWarning
-
I believe the yellow dot means the app is in testing/beta state.
The lack of a run button on the console is explained in the Beta readme and/or in a post above.
The insecure platform thing is tied to new security checks in the requests module.
-
Just another bug report (maybe it's just me doing everything wrong) for the
sk
module:Here is the code I'm using:
# coding: utf-8 import sk import random MAXSPD = 700 MAXLIFE = 15 TEXTURE = 'shp:Circle' MINLIFED = -350 MAXLIFED = 350 SCALE = 2 decayrate = 0.005 collider_f = 0.35 def randvec(maxspd): return (random.randint(-maxspd, maxspd), random.randint(-maxspd, maxspd)) particle_tpl = sk.SpriteNode(sk.Texture(TEXTURE)) particle_tpl.name = 'particle' particle_tpl.color_blend_factor = 1 particle_tpl.age = 0 particle_tpl.lighting_bit_mask = 1 particle_tpl.x_scale = SCALE particle_tpl.y_scale = SCALE particle_tpl.alpha = 0.5 particle_tpl.shadow_cast_bit_mask = 1 physics = sk.PhysicsBody.circle(particle_tpl.size.x/2 * collider_f) physics.restitution = 1.2 physics.affected_by_gravity = False physics.allows_rotation = True physics.mass = 2 physics.pinned = False physics.angular_velocity = 0 physics.category_bit_mask = 1 physics.contact_test_bit_mask = 1 particle_tpl.physics_body = physics class Game (sk.Scene): def __init__(self): sk.Scene.__init__(self) self.name = 'scene' self.particles = set() self.img = sk.Texture(TEXTURE) self.maxspd = MAXSPD self.handles_node_touches = False self.maxlife = MAXLIFE * 60 # convert to frames self.selected = None # init walls for y in [768, 0]: wall = sk.Node() wall.position = (512, y) physics = sk.PhysicsBody.rect(1024, 100) physics.affected_by_gravity = False physics.allows_rotation = False physics.restitution = 1.2 physics.pinned = True wall.physics_body = physics self.add_child(wall) for x in [0, 1024]: wall = sk.Node() wall.position = (x, 384) physics = sk.PhysicsBody.rect(100, 768) physics.affected_by_gravity = False physics.allows_rotation = False physics.restitution = 1.2 physics.pinned = True wall.physics_body = physics self.add_child(wall) # lighting light = sk.LightNode() light.position = (10, 758) light.shadow_color = (1, 0, 0) light.ambient_color = (0, 0, 1) light.light_color = (0, 1, 0) light.enabled = True light.category_bit_mask = 1 light.alpha = 1 light.falloff = 0.4 light.name = 'light' self.add_child(light) def update(self): for p in self['particle']: p.age += 1 if p.age >= p.lifespan: # if exceeded life, reduce alpha by 1 p.alpha -= decayrate if p.alpha <= 0: p.run_action(sk.Action.call(p.remove_from_parent)) def touch_began(self, node, touch): self.selected = None new = particle_tpl.__copy__() new.position = touch.location new.physics_body.velocity = randvec(MAXSPD) new.color = (random.random(), random.random(), random.random()) new.lifespan = self.maxlife + random.randint(MINLIFED, MAXLIFED) #new.z_position = random.randint(0, len(self.get_children_with_name('particle'))) self.add_child(new) def touch_moved(self, node, touch): self.touch_began(node, touch) def did_begin_contact(self, collison): # Make the color change on collison collison.body_a.node.color = (random.random(), random.random(), random.random()) collison.body_b.node.color = (random.random(), random.random(), random.random()) def main(): game = Game() scene_view = sk.View(game) scene_view.shows_fps = True scene_view.shows_node_count = True scene_view.present() return game if __name__ == '__main__': g = main()
It's similar to the old Particles example, however using physics. I'm running into two problems:
- No matter what I do, I can't make the
sk.LightNode()
do anything. - In
did_begin_contact
, I'm getting the following error:
AttributeError: 'NoneType' has no attribute 'color'
It says in the docs that the
collison.body_a.node
attribute should be the node it is attached to, but for me it seems to be just None. - No matter what I do, I can't make the
-
@misha_turnbull It looks like both issues are caused by bugs in
sk.Node.__copy__
. Try setting thelighting_bit_mask
attribute manually after creating the copy. To make the contact callback work properly, you'd probably need to create a newPhysicsBody
instead of relying on the one that gets copied along with the node. I'm looking into this. One other thing: If you want to make your physics bodies "immovable", setdynamic
to False instead ofpinned
toTrue
. -
I must say, after being out of the Python world for a while, this makes me very excited to get back in!!
-
@omz There seems to be some issue affecting the
canvas
module. In both the recent betas (160013 and 160014), your turtle.py example crashes Pythonista immediately. But other simple canvas usage does not. In released versions like 1.5, and the earlier betas, I have only observed canvas crashes when I edited the script while it was running. -
https://github.com/cclauss/pythonista-module-versions is still throwing warnings on
requests
calls in 160014. -
@ccc I mentioned in the release notes why I rolled back to an older version of
requests
. -
I read that but
Pythonista_module_versions.py
is still throwing warnings like it would if you did NOT roll back the version ofrequests
.Requests is indeed fairly current according to
Pythonista_module_versions.py
:| module | local | PyPI | | name | version | version | | ------------- | -------- | ---------- | | requests | 2.6.0 | 2.6.2 |
-
Hmm, looks like something went wrong in my deployment script, should be 2.5.1.
-
This has been a problem for a looong time, but I never got around to reporting it: in the interpreter input field you cannot use the tab key on an external keyboard. It probably tries to switch to the next input field instead, which does nothing, because there is no other input field.
-
P.S. No Watch folder. Not that I am buying a watch. I did the Testflight install over the previous beta, not fresh.
-
misha,
regarding your issue.
new = particle_tpl.copy() #does not correctly copy the physics body.
new.physics_body = particle_tpl.physics_body.copy() #should fix your problem. -
By the way if I have zero scripts is there any reason not to try the beta? I assume any I do create while using the beta might need rescuing by cut and paste (or whatever).
-
@polymerchm Are you running Pythonista on an iPhone? The Watch folder is not created on iPad because the watch can't be paired with that anyway.
-
Gotcha. Haven't installed it on my iPhone yet. So far all else is good on this build. Thanks.
-
@omz, @Gcarver, I've managed to make the
did_begin_contact
work correctly by changingtouch_began
to this:def touch_began(self, node, touch): new = particle_tpl.__copy__() new.physics_body = new.physics_body.__copy__() new.lighting_bit_mask = 1 new.position = touch.location new.physics_body.velocity = randvec(MAXSPD) new.color = (random.random(), random.random(), random.random()) new.lifespan = self.maxlife + random.randint(MINLIFED, MAXLIFED) self.add_child(new)
However, although this makes
did_begin_contact
work correctly, none of the particles are actually appearing. It seems that they have an alpha value of 0, however I know that this isn't true. The node count in the bottom corner tells me that they exist, but they just don't show up. I have tried changing the background color, but it made no difference. -
Misha, your posted code works fine for me, are you sure you didn't make other changes?
Maybe try restarting pythonista?If you also set
new.shadow_cast_bit_mask=1
, then the shadows show up too.Shadows on top of textures seem to be stuck as white, If I add a texture background.. Also, light falloff doesn't seem to affect shadows, which is strange
-
@OMZ Sorry to report the autocomplete bug is stll there. Seems to happen write after typing the "." after an instance of a class. Highly unreproducible.
-
@polymerchm What kind of device are you using?