• Thanks everyone,
    @JonB You cleared my doubt on @ui.in_background, Now I'm using threading instead of ui.in_background

    import ui,threading as thr class view(): def __init__(self): self.flag = True content = ui.TableViewCell() play = ui.Button(frame = (259,0,50,content.height)) pause = ui.Button(frame = play.frame) play.image = ui.Image('iob:ios7_play_256') pause.image = ui.Image('iob:pause_256') pause.hidden = True play.action = self.Play pause.action = self.Pause label = ui.Label(frame =(0,0,0,content.height)) label.touch_enabled = False label.background_color = 'blue' self.play = play self.pause = pause self.label = label self.flag = False content.content_view.add_subview(play) content.content_view.add_subview(pause) content.content_view.add_subview(label) self.content = content def table(self): return self.content def Play(self,sender): t = thr.Thread(target=self.Playy,args=(sender,)) t.daemon = True t.start() def Pause(self,sender): t = thr.Thread(target=self.Pausee,args=(sender,)) t.daemon = True t.start() def Playy(self,sender): sender.hidden = True self.pause.hidden = False import time for a in range(320): self.label.width = a time.sleep(0.1) if self.flag: self.flag = False return def Pausee(self,sender): sender.hidden = True self.play.hidden = False self.flag = True class Llist(): def tableview_number_of_rows(self,t,s): return 40 def tableview_cell_for_row(self,t,s,r): return view().table() a=ui.TableView() a.data_source = Llist() a.allows_selection = False a.present()
  • @JonB You are the man. It was how I had flex set up.

  • @b1rchy, I think no, not easily. Thus you might consider e.g. placing a Label inside the Button, and change the text of that. Or go off the deep end and see if there is something in the underlying ObjC UIButton to help you.

  • @ccc, the hotel app idea is dead. My friend that I wrote the Excel/VBA version for is not in the hotel business anymore. We are Actualling sharing a nice big house together now in Pattaya. A Danish guy, we have been friends for many years. It's a little bit like the old show the odd couple, us to living together, but we still have fun :)

    So no real push for me to do booking thing any more. But I still would like to make a pretty good calendar picker( I honestly hate the Apple DateTime Picker). I have made some before, but I should be able to make something better now. At least I hope so. The other thing I will get back to is my voting app. I always go wrong, as I try to make frameworks instead of just getting on and coding something with brute force just to get it done. Pretty or not. It's funny I should have those problems at this age. I didn't have it when I was younger. I was very aware and sensitive to commercial realities, get it done and out the door! I guess without that need, it changes you.

    Hmmm, just after announcing I should be better. I need to ask something embarrassing. I looked at this last night, for some reason I could not get my head around it.

    Below in the generator you modified, I have added x in the return tuple. I can't figure out how to get x to just be a linear counter ie. 0 to (rows * cols)-1.
    I have looked at it too long so I have decided to ask....My feeling it should be something simple that can be done in place and should not be apart of the comp loops....
    just adding x doesn't make much sense as it appears below, but makes more sense if you are creating objects in the generator rather than a tuple.
    Any help appreciated.

    return ((w * j, h * i, w, h, x) for i in range(rows) for j in range(cols))
  • Everything important has already been said. But just for completeness: I think the pythonic thing to do would be to use list comprehensions here as it would result in shorter and less imperative code. Building on cccs example:

    import ui w, h = ui.get_screen_size() bw = 100 bh = 50 def button_tapped(sender): label.bg_color = sender.bg_color label.text = sender.title label.text_color = sender.tint_color print(label.bg_color) def make_button(title, screen_x, super_view): button = ui.Button( action=button_tapped, alignment=ui.ALIGN_CENTER, bg_color=title.lower(), border_color='black', border_width=1, frame=(screen_x, h - 124, bw, bh), tint_color='white', title=title) # it seems to be necessary to reset the frame button.frame = (screen_x, h - 124, bw, bh) super_view.add_subview(button) return button label = ui.Label( alignment=ui.ALIGN_CENTER, bg_color='silver', border_color='black', border_width=1, frame=(300, 100, 200, 100), name='Label') view = ui.View(name='Color fun', bg_color='darkgrey', frame=(0, 0, w, h)) view.add_subview(label) buttons = {color: make_button(title=color, screen_x=200 + 100 * i, super_view=view) for i, color in enumerate(['blue', 'red', 'yellow', 'green'])} buttons['yellow'].tint_color = 'black' view.present('screen')
  • def omdat(sender): global tel view['Veer'].height = 50 if tel else 120 tel = not tel
  • @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

  • @JonB , hmmm. Yeah it was getting a little tricky. Chicken before the egg thing. But I will look again. It's probably time I shut up and actually try to write something that works and does something 😱
    But thanks again for your long lasting patience 👍

Internal error.

Oops! Looks like something went wrong!