• mikael

    @red_shift, nothing in what you describe requires mixing scene and ui, and although mixing them is definitely possible, it seems borrowing trouble for your first project, as they have different coordinate systems and different operating logics.

    So I would pick one and concentrate on learning the subtleties of that one first.

    My take is that scene holds your hand a bit more, has better out-of-the-box animation capabilities and might be easier to start with, while ui is much more versatile and will serve you in more projects.

    posted in Pythonista read more
  • mikael

    @rb, true, the layout is ”too aggressive”. You can quick-fix it with something like this:

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

    posted in Pythonista read more
  • mikael

    @Luximonsti, you could also share the code you have so far.

    posted in Pythonista read more
  • mikael

    @rb, I guess you are talking about the ZoomPanView that comes with pygestures.

    If so, yes, it does not really expose the functionality you need in a convenient way, but see below, does this do what you were after?

    
    import ui
    
    from pygestures import ZoomPanView
    
    
    class ZoomedOutView(ZoomPanView):
        
        def zoom_to_fit(self):
            bbox = ui.Rect(0,0,1,1)
            zoomer = self.zoomer
            for view in zoomer.subviews:
                bbox = bbox.union(view.frame)
            self.scale = min(
                self.width/bbox.width,
                self.height/bbox.height,
            )
            self._set_transforms()
            zoomer.x = zoomer.y = 0
        
        def layout(self):
            self.zoom_to_fit()
    
    
    z = ZoomedOutView()
    
    images = (
        ('test:Boat', 'test:Bridge', 'test:Gray21'),
        ('test:Lenna', 'test:Mandrill', 'test:Numbers'),
        ('test:Pattern', 'test:Peppers', 'test:Sailboat')
    )
    
    max_y = 0
    for row in images:
        current_x = 0
        current_y = max_y
        for image in row:
            img = ui.Image(image)
            iv = ui.ImageView(image=img,
                x=current_x, y=current_y,
                width=img.size.w, height=img.size.h
            )
            z.add_subview(iv)
            current_x = iv.frame.max_x
            max_y = max(max_y, iv.frame.max_y)
    
    
    z.present('fullscreen', animated=False)
    

    posted in Pythonista read more
  • mikael

    @Bumbo-Cactoni, maybe try and take what you need from this recent example?

    posted in Pythonista read more
  • mikael

    @felciano, I have personally used Apple Shortcuts for these types of tasks. At a quick look, they seem to have a rich set Dropbox commands, not sure about Google Sheets, maybe via calling a URL?

    Could be done in Pythonista as well, although I have no ready code for you.

    posted in Pythonista read more
  • mikael

    @Quicky, can’t say I would have successfully used those libraries, although I have accessed Google services, at least the calendar.

    Can you share a full stack trace of the import attempt? Could you be accidentally running your script in Python 2?

    posted in Pythonista read more
  • mikael

    @jamm, as @JonB said, except look at the def textview_should_change(self, textview, range, replacement) method of the ui.TextView delegate, where you can see that the replacement is \n and can use the range to place the tags in the view.

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!