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.
The performance of button.name is kind of slow?
-
@lpl, for your inspiration, here is a ”buttonlike” that apes the necessary parts of the Button API to act as a drop-in replacement.
#coding: utf-8 from ui import * class Buttonlike(View): def __init__(self, **kwargs): self.label = Label(frame=self.bounds, flex='WH', alignment=ALIGN_CENTER) self.add_subview(self.label) super().__init__(**kwargs) @property def title(self): return self.label.text @title.setter def title(self, value): self.label.text = value @property def tint_color(self): return self.label.text_color @tint_color.setter def tint_color(self, value): self.label.text_color = value def touch_ended(self, touch): if hasattr(self, 'action') and callable(self.action): self.action(self) if __name__ == '__main__': v = Buttonlike(title='Hello world') v.background_color = 'white' v.tint_color = 'black' def action_handler(sender): sender.title = 'Clicked' v.action = action_handler v.present()