• rb

    No I mentioned vibrancy- ie I want bg to be blurred but a central rectangle to be not blurred and more vibrant.

    posted in Pythonista read more
  • rb

    Ah ok - so what is the difference then between fill and label?I just thought label would be isolated to text - but it I’ll try that!

    posted in Pythonista read more
  • rb

    How could you apply the vibrancy effect to work with a rectangular region rather than a label? I read there is a fill method and a separator method but not sure how you would implement.

    posted in Pythonista read more
  • rb

    Cheers everyone, Jon that’s where I nabbed that snippet from in first place! The issue is the proximity to the edge of the image I think, mine were very close to the edge so I tried a bigger black border and I did try messing with the numbers a bit on properties.Seems to work better but still not perfect.

    posted in Pythonista read more
  • rb

    Hmm ok so your saying 2 colour works better - I only used that test image as I couldn’t work out how to upload an image here…
    this is more like the kind of images I want to use though, ie long thin horizontal rectangles mostly - seems to struggle, try :

    iow:drag_256

    It creates extra rectangles at top and bottom bounds- how can I remove these?

    posted in Pythonista read more
  • rb

    I found another post regarding text recognition and iOS vision and recognise rectangle is mentioned there so cut out the text aspect and adapted it: (thanks jonb)

    But I can’t get what I need from this - I have tried altering the VNDetectRectanglesRequest properties.
    Basic issue is even though it’s a very simple image = seems to struggle identifying accurately the edges.

    from objc_util import *
    import ui
    
    
    ui_image=ui.Image.named('test:Gray21')
    ui_image.show()
    
    load_framework('Vision')
    VNDetectRectanglesRequest = ObjCClass('VNDetectRectanglesRequest')
    VNImageRequestHandler = ObjCClass('VNImageRequestHandler')
    
    handler = VNImageRequestHandler.alloc().initWithData_options_(ui_image.to_png(), None).autorelease()
    
    req = VNDetectRectanglesRequest.alloc().init().autorelease()
    
    req.maximumObservations=0
    req.minimumSize=0.01
    req.minimumAspectRatio=0.0
    req.maximumAspectRatio=1.0
    req.quadratureTolerance=10
    
    success = handler.performRequests_error_([req], None)
    with ui.ImageContext(*tuple(ui_image.size) ) as ctx:
       ui_image.draw()
       for result in req.results():
          cgpts=[result.bottomLeft(),
                                            result.topLeft(),
                                            result.topRight(),
                                            result.bottomRight(),
                                            result.bottomLeft()] 
          verts = [(p.x*ui_image.size.w, (1-p.y)*ui_image.size.h) for p in cgpts]
          pth = ui.Path()
          pth.move_to(*verts[0]) 
          for p in verts[1:]:
             pth.line_to(*p)  
          ui.set_color('red')
          pth.stroke()
          x,y = verts[0]
          w,h =(verts[2][0]-x), (verts[2][1]-y)
         
       marked_img = ctx.get_image()
       marked_img.show()
    

    posted in Pythonista read more
  • rb

    Vision iOS framework looks perfect actually so yes please would be interested in how to implement such a thing in Pythonista for sure.

    posted in Pythonista read more
  • rb

    Hiya
    So I don’t have an image it’s just in my head but initially yes I’m thinking rectangles black on white or white on black.They could be arbitrary sizes I’m thinking - I just want use them to create edges that I can repurpose as coordinates for building other elements with.

    posted in Pythonista read more
  • rb

    Hi
    Say I have a 2 colour image containing a number of rectangles.I would like to convert that image into an array of x,y cords at the corners of those rectangles.
    Given that opencv won’t work for Pythonista what would be the best way to approach this?

    posted in Pythonista read more
  • rb

    Thanks that’s done it and is a lot easier.
    I used :
    button. content_mode=ui.CONTENT_SCALE_ASPECT_FIT
    So seems to work ok without objC.
    Thanks!

    posted in Pythonista read more
  • rb

    What’s the simplest way to be able to programmatically resize a ui.Image generated from a jpg file for a button background image?
    Can I do it with imageContext? Or is PIL the way to go?

    posted in Pythonista read more
  • rb

    Hi
    I am trying to provide some shortcuts to open some pdfs that I have in a Dropbox folder.
    Firstly how do I establish a useable file path to a file in a Dropbox folder?
    Secondly how would I open a pdf via Pythonista? I’m thinking quick look or at a push iBooks?

    thanks
    Rich

    posted in Pythonista read more
  • rb

    Wow above and beyond the call of duty thankyou!

    posted in Pythonista read more
  • rb

    I turned on and off the “Extra Key Row” option in the “Settings>Keyboard and Typing” option.seems to fix it if it happens.Annoying though!

    posted in Pythonista read more
  • rb

    Hi is it possible to display matching paired brackets /curly braces etc? I’m sure this used to be the case.ie if you had a JSON file and selected a curly brace it matching brace would be highlighted /selected in correct location.

    Is it possible to change the extra keyboard shortcuts above main virtual keyboard to appear as one large spaced line of options rather than two v small menus on the left and right? Is this an option as again I’m sure it didn’t used to look like this.

    Cheers
    Rich

    posted in Pythonista read more
  • rb

    @mikael said:

    first = True
    def layout(self):
    if self.first:
    self.zoom_to_fit()
    self.first = False

    Perfect exactly what I’m after thankyou Mikel :)

    posted in Pythonista read more
  • rb

    @mikael thanks for replying - this almost does exactly what I’m after yes but it appears to disable any subsequent zooming after the view is initially built.
    I’d like the functionality of the zoom /pan as normal after the initial placement ideally.
    I will try and work out how to re-enable that from your code though - thanks again!

    posted in Pythonista read more
  • rb

    Hi pythoneestas and prob mostly @mikael

    I have a ZoomPanView that has an arbitrary number of images inside it.

    I would like the view to initially when first built to fit entirely inside the screen
    ie the view is much larger than this as it contains many other images.

    I can’t find a way of scaling it such that it’s already “zoomed out” and shows all its contents as it would be if it was “touch zoomed out”.
    It always gets built just showing the top left portion of the first image in its contents.
    I’ve tried .scale .start_scale etc and no luck.

    rich

    posted in Pythonista read more
  • rb

    Thanks that’s exactly what I’m after!

    posted in Pythonista read more
  • rb

    Thankyou - that’s masking an image with a colour and altering the alpha of the colour - isnt there a way to gradually alter an imageViews alpha over time?

    posted in Pythonista read more
Internal error.

Oops! Looks like something went wrong!