omz:forum

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

    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 2
    • Topics 4
    • Posts 60
    • Best 13
    • Controversial 0
    • Groups 0

    pulbrich

    @pulbrich

    22
    Reputation
    984
    Profile views
    60
    Posts
    2
    Followers
    0
    Following
    Joined Last Online

    pulbrich Unfollow Follow

    Best posts made by pulbrich

    • RE: Comment/Uncomment block of lines

      Put the following code to your sites packages folder and create a shortcut under the wrench tool.

      
      #Comment/Uncomment selected lines
      
      import editor
      
      text = editor.get_text()
      selection = editor.get_line_selection()
      selected_text = text[selection[0]:selection[1]]
      is_comment = selected_text.strip().startswith('#')
      replacement = ''
      for line in selected_text.splitlines():
          if is_comment:
              if line.strip().startswith('#'):
                  replacement += line[line.find('#') + 1:] + '\n'
              else:
                  replacement += line + '\n'
          else:
              replacement += '#' + line + '\n'
      
      editor.replace_text(selection[0], selection[1], replacement)
      editor.set_selection(selection[0], selection[0] + len(replacement) - 1)
      
      
      posted in Pythonista
      pulbrich
      pulbrich
    • 3D puzzle game with sceneKit

      I have added a 3D cube puzzle to the demo scripts of the sceneKit wrapper.

      Apart from the entertainment value of the puzzle, the scrips demonstrate how to run several sceneKit views simultaneously.

      Needs today’s version of the sceneKit package and the pythonista-gestures module.

      Have fun!

      posted in Pythonista
      pulbrich
      pulbrich
    • RE: If, like me, your iDevice is too old for ARKit...

      @vignesh : if you want to use SceneKit in a more convenient way, there is a Pythonista wrapper with plenty of examples here:

      posted in Pythonista
      pulbrich
      pulbrich
    • RE: ui.ImageView contents not cropping to View bounds

      It’s a uiView property, supposed to regulate the behavior of a view’s subviews.

      Instance Property
      clipsToBounds
      A Boolean value that determines whether subviews are confined to the bounds of the view.
      
      posted in Pythonista
      pulbrich
      pulbrich
    • SceneKit wrapper available

      Greetings!

      I have finished a sceneKit wrapper for Pythonista. It is available for installation together with 15 sample scripts (several of which was inspired by the forum community).

      The wrapper is rather comprehensive and can be used according to the official SceneKit documentation, with some deviations described in the README.

      Have fun and let me know if something is broken.

      Peter

      posted in Pythonista
      pulbrich
      pulbrich
    • RE: Function at end of variable (Don't really know how to sum up this question)

      You can subclass str and insert your method in the subclass definition. As long as you use your subclass to create your “string” instances the new method would work. Not for literals though. E.g.,

      class funny_string(str):
        def clean(data):
           while data.startswith(' '): data = data[1:]
           while data.endswith(' '): data = data[:-1]
           return data
      
      my_string = funny_string(“ look at this! “)
      print(my_string.clean()) #### works
      print(“ huh? “.clean()) #### doesn’t work
      
      posted in Pythonista
      pulbrich
      pulbrich
    • RE: No update?

      @cvp said:

      I had remarked similar moustaches but I didn't dare post something

      I guess it just comes with experience.

      posted in Pythonista
      pulbrich
      pulbrich
    • RE: How to get Reminders of Specific Calendars

      Did you try this?

      reminders.get_reminders(calendar=None, completed=None)
      

      Return all reminders in the given Calendar (or all calendars). Seems exactly what you are looking for.

      posted in Pythonista
      pulbrich
      pulbrich
    • RE: Finding the values of some enum constants

      Change the language to Swift on Apple’s docu pages and you will see the values (in this case anyway).

      posted in Pythonista
      pulbrich
      pulbrich
    • RE: I'm stuck in a loop that crashes the app on startup every time. I suspect the solution is simple, but I don't know what it is. Please help.

      Try in system settings/Pythonista- launch in safe mode

      posted in Pythonista
      pulbrich
      pulbrich

    Latest posts made by pulbrich

    • RE: 3D rotations in a UImage

      Have a look at this wrapper for sceneKit. There are plenty of examples, too. Though I made no regression tests lately it should still work, or at least help with understanding the bridging.

      link to the GitHub repo

      posted in Pythonista
      pulbrich
      pulbrich
    • RE: If, like me, your iDevice is too old for ARKit...

      @vignesh : if you want to use SceneKit in a more convenient way, there is a Pythonista wrapper with plenty of examples here:

      posted in Pythonista
      pulbrich
      pulbrich
    • RE: Comment/Uncomment block of lines

      @Ivan_OE I didn’t write this code, only use it. But I am happy if it helped.

      posted in Pythonista
      pulbrich
      pulbrich
    • RE: Getting 'set' to print

      In your original code move the first closing bracket “)” to the end of the line, the idea being than in python 3.x the print statement needs the arguments in brackets, i.e.

      print(“something”)
      
      print ('All scanned codes:\n' + '\n'.join(found_codes) )
      

      should work.

      (The original code was ok in python 2.x)

      posted in Pythonista
      pulbrich
      pulbrich
    • RE: Function at end of variable (Don't really know how to sum up this question)

      You can subclass str and insert your method in the subclass definition. As long as you use your subclass to create your “string” instances the new method would work. Not for literals though. E.g.,

      class funny_string(str):
        def clean(data):
           while data.startswith(' '): data = data[1:]
           while data.endswith(' '): data = data[:-1]
           return data
      
      my_string = funny_string(“ look at this! “)
      print(my_string.clean()) #### works
      print(“ huh? “.clean()) #### doesn’t work
      
      posted in Pythonista
      pulbrich
      pulbrich
    • RE: Regex and numpy question

      Then you can use re, which is the Pythonista supplied regex module.

      posted in Pythonista
      pulbrich
      pulbrich
    • RE: Regex and numpy question

      If I run

      import re
      
      print(re)
      
      

      I get

      <module 're' from '/var/containers/Bundle/Application/7F183C05-845F-47C3-93D3-533E30766BBB/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/re.py'>
      

      which is what it should be. Could you try these two lines of code and show the console output?

      posted in Pythonista
      pulbrich
      pulbrich
    • RE: Regex and numpy question

      Try

      import re
      

      You cannot upgrade numpy, the available version is part of the Pythonista app, not user upgradable.

      posted in Pythonista
      pulbrich
      pulbrich
    • RE: No update?

      Louder, please.

      posted in Pythonista
      pulbrich
      pulbrich
    • RE: ui.ImageView contents not cropping to View bounds

      It’s a uiView property, supposed to regulate the behavior of a view’s subviews.

      Instance Property
      clipsToBounds
      A Boolean value that determines whether subviews are confined to the bounds of the view.
      
      posted in Pythonista
      pulbrich
      pulbrich