omz:forum

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

    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 5
    • Posts 12
    • Best 0
    • Controversial 0
    • Groups 0

    FrankenApps

    @FrankenApps

    0
    Reputation
    741
    Profile views
    12
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    FrankenApps Unfollow Follow

    Latest posts made by FrankenApps

    • RE: Pure Python gestures

      Wow, this is very impressive. Sorry for that most likely stupid question: Is there a way to use this with a scene? I am trying to make a scene zoom+panable, but I did not manage to do it.
      I wanted to use

      def on_pinch(self, data):
          self.scale = data.scale 
      

      and

      def on_pan(self, data):
          self.frame = (data.translation.x, data.translation.y, self.width, self.height)   
      

      inside my scene class, where I would have got self.width and self.height before from ui.get_screen_size...

      Maybe someone could provide me with a basic example for a zoom and panable scene?
      Would be great, thanks in advance.

      posted in Pythonista
      FrankenApps
      FrankenApps
    • RE: How to prevent button flickering on title change?

      @cvp Thanks, I‘ll Play around with this a bit. I have Not seen that other thread, so sorry for the duplicate..

      posted in Pythonista
      FrankenApps
      FrankenApps
    • How to prevent button flickering on title change?

      Whenever I update the title of a ui.button an animation is shown (so it appears as if the button flickers).

      This seems to be normal on iOS, and this is how it can be prevented in native Apps: https://stackoverflow.com/questions/18946490/how-to-stop-unwanted-uibutton-animation-on-title-change

      Is there a way to prevent this animation in Pythonista (for example using obj_c )?

      I would really like to use a button and not a custom view...

      posted in Pythonista
      FrankenApps
      FrankenApps
    • RE: How to send 'CTRL-C' to console, when close button in ui is tapped?

      Yes, but the Script is still running, even so the UI is closed

      posted in Pythonista
      FrankenApps
      FrankenApps
    • RE: How to send 'CTRL-C' to console, when close button in ui is tapped?

      @cvp I do it with:

      v=ui.loadView()
      v.present(style=full_screen, orientations= ['portrait'])
      

      the title bar is shown by default, isn't it?
      I can post the whole code later if necessary...

      posted in Pythonista
      FrankenApps
      FrankenApps
    • How to send 'CTRL-C' to console, when close button in ui is tapped?

      button in Pythonista.

      Is there a way to send 'CTRL-C' via the UI close button in the title bar?

      I want to call

      except KeyboardInterrupt:
        cb.reset()
      

      when the close button in the title bar is tapped.

      I have tried making the main View a customView and then using

      class MainView(ui.View):
       def will_close(self):
         print('Closing')
         cb.reset()
         sys.exit(0)
      

      button in order to stop the script execution.

      Only to be clear: I do not want to close Pythonista, I only want to stop the script from running, when I hit the close button in the UI and return to the console/editor.

      posted in Pythonista
      FrankenApps
      FrankenApps
    • RE: Weird error when script is run from homescreen.

      @cvp
      Thank you very much!

      posted in Pythonista
      FrankenApps
      FrankenApps
    • Weird error when script is run from homescreen.
      import ui, sound
      
      #sound.set_honors_silent_switch(False) #maybe for production
      
      class ButtonWrapper(ui.View):
      	
      	def touch_began(self, touch):
      		imageName = self.subviews[0].path
      		imageName = imageName[12:][:-7]
      		imageName = 'res/buttons/' + imageName +'on.png'
      		self.subviews[0].image = ui.Image.named(imageName).with_rendering_mode(ui.RENDERING_MODE_ORIGINAL)
      		self.subviews[0].path = imageName
      		sound.play_effect(self.subviews[0].name)
      		
      	def touch_ended(self, touch):
      		imageName = self.subviews[0].path
      		imageName = imageName[12:][:-6]
      		imageName = 'res/buttons/' + imageName +'off.png'
      		self.subviews[0].image = ui.Image.named(imageName).with_rendering_mode(ui.RENDERING_MODE_ORIGINAL)
      		self.subviews[0].path = imageName
      		
      
      v = ui.load_view()
      
      v.present(style = 'full_screen', orientations = ['portrait'],title_bar_color='#222222', hide_title_bar=True) #In order to exit swipe down with two fingers
      

      So I have a Script, that is supposed to change a background picture of a button while it is pressed.
      I have stored the pictures in "res/buttons/" where one is for example called "orangeoff.png" and one is called "orangeon.png". With the above code I can achieve what I want.
      However when I add the Script to the homescreen to run it from there I get the following exception most of the time:

      Traceback (most recent call last):
        File "/private/var/mobile/Containers/Shared/AppGroup/C1A7CE9F-6A30-4CA8-9380-76FD1CACD07F/Pythonista3/Documents/main.py", line 19, in touch_ended
          self.subviews[0].image = ui.Image.named(imageName).with_rendering_mode(ui.RENDERING_MODE_ORIGINAL)
      AttributeError: 'NoneType' object has no attribute 'with_rendering_mode'
      

      When I hit the back button on the left top, and basically reload the view, everything works as expected again. Does anybody have an idea, why this might happen, and how to prevent it?

      For clarification, this is my .pyui file (the view above the button is only needed to prevent the touch effect):

      [
        {
          "nodes" : [
            {
              "nodes" : [
                {
                  "nodes" : [
      
                  ],
                  "frame" : "{{0, 0}, {240, 247}}",
                  "class" : "View",
                  "attributes" : {
                    "frame" : "{{46, 2}, {100, 100}}",
                    "class" : "View",
                    "name" : "view1",
                    "uuid" : "02ECED66-9D85-4C76-94DC-0FBB760E6596"
                  },
                  "selected" : false
                },
                {
                  "nodes" : [
      
                  ],
                  "frame" : "{{0, 0}, {240, 247}}",
                  "class" : "Button",
                  "attributes" : {
                    "action" : "",
                    "frame" : "{{10, 34}, {80, 32}}",
                    "title" : "",
                    "uuid" : "350C205C-A1B2-41CA-B6ED-EA120173BF4C",
                    "class" : "Button",
                    "custom_attributes" : "{'image':ui.Image.named('res\/buttons\/blueoff.png'). with_rendering_mode(ui.RENDERING_MODE_ORIGINAL), 'path': 'res\/buttons\/blueoff.png'}",
                    "font_size" : 15,
                    "name" : "res\/sounds\/intro.mp3"
                  },
                  "selected" : false
                }
              ],
              "frame" : "{{0, 0}, {240, 240}}",
              "class" : "View",
              "attributes" : {
                "uuid" : "C5101DD7-0CBA-448A-8BC8-34F0CF0347B3",
                "frame" : "{{110, 950}, {100, 100}}",
                "class" : "View",
                "name" : "view1",
                "custom_class" : "ButtonWrapper"
              },
              "selected" : false
            }
          ],
          "frame" : "{{0, 0}, {240, 240}}",
          "class" : "View",
          "attributes" : {
            "name" : "",
            "enabled" : true,
            "background_color" : "RGBA(1.000000,1.000000,1.000000,1.000000)",
            "tint_color" : "RGBA(0.000000,0.478000,1.000000,1.000000)",
            "border_color" : "RGBA(0.000000,0.000000,0.000000,1.000000)",
            "flex" : ""
          },
          "selected" : false
        }
      ]
      
      posted in Pythonista
      FrankenApps
      FrankenApps
    • RE: Unlimited backgrounding

      This is sadly not working anymore in recent versions of pythonista, am I right?

      posted in Pythonista
      FrankenApps
      FrankenApps
    • RE: Get the value of a custom attribute in a ui.button

      Thank you,
      but this is not quite what I was looking for...
      I ended up declaring another custom attribute which contains the path. It will result in a bit more work in the UI Designer, but at least it works.

      posted in Pythonista
      FrankenApps
      FrankenApps