def aktualisiere(self, dt): ui.Szene.aktualisiere(self, dt) if self.running_task: progress = min(1.0, self.progress_view.progress + 0.01) self.progress_view.progress = progress self.running_task = (self.progress_view.progress < 1.0) self.task_button.enabled = not self.running_task if self.task_button.enabled: ui.show_alert("I'M FINISHED!", title='Milkshake') self.progress_view.progress = 0 self.progress_view.hidden = True
def show_alert(self, btn, mbtn): msgs = [ 'This is an alert', 'This is an alert with\na line break in it', 'This is a rather long alert that should ' + 'automatically word wrap to multiple lines', 'This is an very long alert that should ' + 'automatically word wrap to multiple lines...' + 'is this not the best thing EVAR? wow, mindblowing...' ] msg = random.choice(msgs) ui.show_alert(msg)
def greet(self, btn, mbtn): name = self.name_textfield.text.strip() if len(name) == 0: name = 'uh, you?' ui.show_alert(title='Greetings!', message='Hello, %s' % name)