omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. themusicman

    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.


    • Profile
    • Following 0
    • Followers 0
    • Topics 9
    • Posts 26
    • Best 1
    • Controversial 0
    • Groups 0

    John

    @themusicman

    Well, I'm in my mid 50's so quite possibly an oldie compared to many of the members here... but I am thoroughly enjoying learning about coding etc. I love photography and synthesisers, too!!

    By all means reach out and say hi!

    Current project: trying to write a Connect4 game using Pythonista on the iPad

    IDE: PyCharm for OSx

    1
    Reputation
    711
    Profile views
    26
    Posts
    0
    Followers
    0
    Following
    Joined Last Online
    Location Wales, UK

    themusicman Unfollow Follow

    Best posts made by themusicman

    • RE: How to add image(s) from iPad camera roll to Pythonista image library

      Thanks @cvp - when I checked originally, after adding the files via the method you describe, I wasn't seeing any files in the +, images, files area. However, and very typically... when I checked immediately after reading your last reply they are indeed there.

      Thanks again.

      posted in Pythonista
      themusicman
      themusicman

    Latest posts made by themusicman

    • RE: Transfer folder from iphone to ipad

      You can also use iCloud to share / move your Pythonista files between your iPhone, iPad and Mac. 👍

      posted in Pythonista
      themusicman
      themusicman
    • RE: Syntax for scene_drawing module...

      Thanks @jonb much appreciated. I’ve now managed to get the webIDE up and running, too!

      So, I have done some stuff using the spritenode system, and managed to pretty much successfully (well at least for me!) to get a version of connect4 coded and working using the default game/animation template as the start. However, I couldn’t find any way of drawing a simple line... surely I am missing something here Jon, and one should easily be able to do that somehow? Any pointers?

      posted in Pythonista
      themusicman
      themusicman
    • RE: How to add image(s) from iPad camera roll to Pythonista image library

      Thanks @cvp - when I checked originally, after adding the files via the method you describe, I wasn't seeing any files in the +, images, files area. However, and very typically... when I checked immediately after reading your last reply they are indeed there.

      Thanks again.

      posted in Pythonista
      themusicman
      themusicman
    • RE: How to add image(s) from iPad camera roll to Pythonista image library

      @cvp said:

      When you use the bottom right + button, you don’t import the icon but only it’s name that you can use as ui.Image. named(‘xxx’)

      Aha... thanks for the clarification. Is there a way one can add to the library of images/sounds etc available within Pythonista?

      I am not planning on using he UI module in this particular script, but have found a way of displaying and possibly using an image for a screen background using the PIL image library.

      posted in Pythonista
      themusicman
      themusicman
    • RE: How to add image(s) from iPad camera roll to Pythonista image library

      So @cvp - I have done this but I am not sure where the image I allegedly imported has been stored within Pythonista. When I try to select that image as I would for any image selection, the image does not appear anywhere.

      So, say I want to use 'emj:Black_Circle' as an image, when I click the bottom right to get the Pythonista dialogue box for adding new image / sound / colour / font etc, the image I just imported is nowhere to be found.

      Specifically, I want to add an image from my photo library to use as the background image for a Pythonista app.

      Am I doing this correctly?

      posted in Pythonista
      themusicman
      themusicman
    • Syntax for scene_drawing module...

      Hi All

      So I am trying to draw a simple line in Pythonista. I have selected a new game type template and the documentation states;

      scene_drawing — Drawing Functions for the scene module
      The functions in this module can be used within the scene.Scene.draw() method when using the classic render loop mode of the scene module.
      

      The default game/animation template is thus;

      from scene import *
      import sound
      import random
      import math
      
      A = Action
      
      class MyScene(Scene):
      	def setup(self):
      		pass
      
      	def did_change_size(self):
      		pass
      
      	def update(self):
      		pass
      
      	def touch_began(self, touch):
      		pass
      
      	def touch_moved(self, touch):
      		pass
      
      	def touch_ended(self, touch):
      		pass
      
      if __name__ == '__main__':
      	run(MyScene(), show_fps=False)
      
      

      From the documentation I think I need to set up a def draw(self): function, but I am not sure what the documentation means when it refers to the scene.Scene.draw() method when using the classic render loop mode of the scene module.

      Could someone help explain the syntax of what I need to include where please. Many thanks.

      posted in Pythonista
      themusicman
      themusicman
    • RE: [SOLVED] Calling methods every n seconds in scene.update()

      @Splefix said:

      @themusicman Haha brother, God just helped me figure that out myself! Thank you very much though for your answer! God bless you abundantly and may peace be with you!!!

      Nice meeting you brother!

      You're very welcome matey...

      posted in Pythonista
      themusicman
      themusicman
    • RE: [SOLVED] Calling methods every n seconds in scene.update()

      @Splefix - specifically for your example...

      # you will need the time module, so...
      import time
      
      # set the variable for your single timer
      last_task1=time.time()
      
      # then execute task1 every 1 second if 'your_statement' is true
      if your_statement == True:
          if time.time()-last_task1>=1:
              # run whatever code you need to execute every 1 second here
              # put your code for task1 here
      
              # then reset the timer for this task1
              last_task1=time.time()
      
      posted in Pythonista
      themusicman
      themusicman
    • RE: [SOLVED] Calling methods every n seconds in scene.update()

      So @Splefix - I have done something similar previously, where I needed to run different tasks at different intervals. Specifically, it was to upload IoT data from a pressure/temp/humidity sensor I have here, to an online MQTT server - but that is by the by.

      This script shows how to set up 3 separate timers for task1, task2 and task3 (obviously amend the number of variables for your specific requirements)

      # you will need the time module, so...
      import time
      
      # Then simply set up timers for each task you wish to run
      last_task1=time.time()
      last_task2=time.time()
      last_task3=time.time()
      
      # Execute specific tasks within each variable you have set up above
      
      # to execute task1 every 5 seconds
      if time.time()-last_task1>=5: 
          # run whatever code you need to execute every 5 seconds here
          # put your code for task1 here
          
          # then reset the timer for this task1
          last_task1=time.time()
          
      
      # to execute task2 every 300 seconds
      if time.time()-last_task2>300: 
          # run whatever code you need to execute every 300 seconds here
          # put your code for task2 here
      
          # then reset the timer for this task2
          last_task2=time.time()
          
      
      # to execute task3 every 3 seconds
      if time.time()-last_task3>3: 
          # run whatever code you need to execute every 300 seconds here
          # put your code for task2 here
      
          # then reset the timer for this task3
          last_task3=time.time()
      

      Hope this helps.

      posted in Pythonista
      themusicman
      themusicman
    • RE: How to get a SpriteNode to change image / colour on screen-touching another Sprite?

      Absolutely loving the help and support from experts on here, thanks so much guys and gals.

      @Splefix - that's an awesome idea, thanks for the suggestion.

      @JonB - yep, this is exactly what I ended up doing, Jon. Once I had my head around the logic and syntax, even this old chap managed to code this section in a few mins.

      Still a few things to iron out in the code, but all in all, for my first real attempt at a slightly longer Python script than Print("Hello World:), I am pretty pleased with myself.

      Connect4 coded in Pythonista and running (albeit with a few glitches) on my iPad. Who'd have thunk it!! haha

      posted in Pythonista
      themusicman
      themusicman