• Hmm, to be size and orientation friendly the last post's make_view should be as below. Forgot to set the flex attr to 'lrtb'

    def make_view(self): rows = 20 cols = 15 # another way, its a little crazy...but maybe @ccc likes it :) [self.add_subview(self.create_ui_obj(ui.Button, name=str(i),frame=f.inset(5,5), border_width=.5, corner_radius= 6, title=str(i), action = self.btn_action, bg_color='maroon', tint_color='white', flex='tlbrwh')) for i, f in enumerate(flattened_list(grid_rc_(self.bounds, rows, cols)))]

    Edit: sorry another screw up. The flex should be 'tlbrwh', modified the code also 🙄

  • Made more improvements today. The biggest dealing with the view names. I added a parameter to the 2 main functions to accept a list of names. I think I have done this in quite flexible way. I have commented the code. but this was a big thing missing, I think my approach is a pretty reasonable solution.

    I also added @JonB ViewWalker Class. it's very helpful. Most notably in MyClass (Example implementation ). You can easily access all your views with dot notation via one class attr. I have commented on this in the code.

    I did some other things such as a dynamic attr to the views created in the module called vid (View ID). Maybe not necessary, but it's still helpful for the sake of a few bytes per view.

    One thing I am conflicted about is the code similarities between the 2 main functions. is so tempting to try and merge them, but my gut feeling is this would be a mistake. Well for me it would be a mistake, lets say that. if I tried to combine them, I would be worried about really weird logic creeping in. I should be able to remove some of it into a different function that both funcs call. baby steps....

    I have a few things directly on my mind that I need to think about.

    when splitting a view, should the view being split be renamed. in a practical sense, it seems so. but this can make things a little ambiguous also. when splitting a view, should you inherit the visual aspects of the parent? Or maybe support kwargs, apply to the parent as well as the new views. The latter is starting to make more sense. Does split_view_h need to be able to split vertically as well.

    A few other smaller issues to consider also.

    Again, I know for a lot, this is not exciting. For me though, it is. it's only a wireframe so to speak. But getting wirefames in place to start populating them with tables/controls etc can be so frustrating and time consuming. and it's about the least exciting thing you have to do. if you can just knock out the wireframe quickly and start adding your functionality, to me that's great.

    Btw, the code looks long. it's not. it's just all the commentary.

    New gist Here.

  • @Phuket2 thanks a lot for sharing this, helps a ton.

  • Don't think toooo hard before you post to the forum... we love to see your crazy ideas in their raw form. But do consider running Check Style and Analyze (PyFlakes) as they find simple issues (like your unused variable) and push you to make your code more readable. I have become big fan of autopep8 on my Mac. It would be cool to see that level of automatic reformatting as an option in Pythonista.

  • @cvp , lol. Me also. Maybe mine is a hexagon, then I am sh*t out of luck with that shape. A rect would be better for me 😱😬😬👀

  • Thanks. Corrected in gist.

  • @abcabc , you should take a look at this module for guestures if you have not seen it Github. @JonB pointed me to this one. I have just started to try it. It's nice. Very easy to get up,and running. Especially for a long press. Is simple. Pinch is also easy, but I can see the more you have your head around the Transforms then do anything. Anyway, if you haven't seen, I think this would be right up your alley

Internal error.

Oops! Looks like something went wrong!