• @adrius42, just making sure you are not appending or overriding list, which is a built-in.

  • Well restart fixed it.... for now! Something funky going on....

  • OMG why did I try a read the manual, I found a part in the manual that showed me that *100 would not work!?

    And yet it all did!

    a=[0]*100 print(a) a[10]=1 print(a) a[10]=a[10]+1 print(a) b=['']*100 print(b) b[10]='test' print(b) b[10]=b[10]+'again' print(b)

    Btw I wasn’t trying to do a sort that was just a historical side comment, but thanks for the pointer, stored for future reference.

    Adrius42

  • Here is a sample of using ui.textfield for input in scene

    Here is a pic of textfield receiving input in Scene.

  • @adrius42 and if you want the name of an emoji

    see here

    Or

  • @adrius42 Very old, indeed. I knew also Algol, like Fortran, Pl/1, Cobol, Apl and all IBM Main frames languages, all were not object oriented, thus all variables were "native", thus this difference did not exist.
    Welcome in the world of Pythonista, marvelous app for retired people 😂

  • @JonB have finally sussed the some of the mysteryies of Stash, not least how to run it!
    How would I have discovered the existence of the -la extension to ls without your kind help?
    I have tried ‘man ls’ with no joy...

  • Thanks guys for the specific pointer, ‘catch just the exception you WANT to catch”

    AND THE GREAT READ, which reinforced the importance of the specific pointer above, as well as fully Logging exception events.

    The Doh! lesson is now learnable at a great new depth...

    I now only except “FileNotFoundError”

  • It took me a while I kept getting weird errors I couldn’t grok (what do you mean it doesn’t have a .remove!?)
    Eventually I understood not all variables are mine to name and the importance of understanding that .assets.remove is two operations on the set

    Python is more powerful than I have yet fully grasped, but with your help I am getting there...

    I sense I need to go back and grok some more basics but testing the boundaries of my knowledge is also fun, it just means that my knowledge graph looks more like an octopus than an ever expanding circle!

    Thanks folks...

    <<I thought I had created the set of photos outside the while loop

    I thought favourites.assets was my variable>>

    I was clearly wrong!

  • Turns out that the issue is that the interpreter hands out random errors, when a real error exists, but update has tried starting up and resulting timing issue is apparently the cause of the random errors. I was moving the missing attribute setup up in the setup code, and not fixing the hidden code issues.

    The best advice was to comment out update and track down the actual errors.

    Which turned out to be COLS & ROWS set up at the top of the script, were ignored and set up as a local variable in my def Paint_Photos(self) code

    My solution was to declare them as global, still not clear why COLS & ROWS worked in the game example but not in my code! Thinking I should have passed ROWS and COLS to Paint_Photos

    Thanks folks, I could not have made progress without the TLC of @JonB & @enceladus
    (Truly Learned Coding!)

    Btw delaying update simply changed the random errors??!!

  • http://omz-software.com/pythonista/docs/ios/scene.html#scene.Node.remove_all_actions
    will stop pending actions on a node. I wouldnt try to use any threading methods in scene; for one thing, I think scenes are all a single thread -- an update method gets called once per frame, and actions execute one cycle per frame. You dont want to block in any scene methods. Actions just get executed a step at a time before the next update is called.

  • Because img_name is not an attribute of SpriteNode! It is just a name you made up. Look back at the docs of SpriteNode.

  • if you add

    print('X:{:.2f} Y:{:.2f} Z:{:0.2f}'.format(*g))

    after the g = gravity() line in update, this will print the gravity direction (it will show up at the very bottom line, or will show up in console later when you stop the script)

    The gravity vector is the direction if gravity, relative to your phone's physical coordinate system: Z points out of the screen, Y points from home button to camera, and X points right in normal portrait mode.

    When you hold your phone up to a wall, so you are looking at the screen in front of you with the home button on the bottom edge like you would normally hold it to make a phone call, gravity should read near -1 in Y, but 0 for the other axes.

    If you then rotate it 90 degrees counter clockwise, so the home button is on the right side, but screen still vertical, X should read -1.

    if you lay it flat on the table, screen up, Z should be near -1 and the other two are near zero.
    If you hold it screen

    If you confirm that is the case, i think one of two things happened.

    Make sure you are not running in any sort of split screen mode. im not sure how scene behaves when you run split screen.

    Also, make sure you have this line

    run(Game(), PORTRAIT, show_fps=True)

    if you had changed to LANDSCAPE, or nothing at all, then things would be as you described, since the game logic assumes that g.x is left/right. if you are in landscape, g.y increases when you tip left/right, while g.x would change by tipping forward/back.

    in case you editing something by accident, the motion logic looks like

    if abs(g.x) > 0.05: x = self.player.position.x # The components of the gravity vector are in the range 0.0 to 1.0, so we have to multiply it with some factor to move the player more quickly. 40 works pretty well, but feel free to experiment. max_speed = 40 # We simply add the x component of the gravity vector to the current position, and clamp the value between 0 and the scene's width, so the alien doesn't move outside of the screen boundaries. x = max(0, min(self.size.w, x + g.x * max_speed)) self.player.position = (x, 32)
Internal error.

Oops! Looks like something went wrong!