Updated Using Asynchronous programming inside a Kivy application (markdown)

timothy eichler 2016-12-17 19:09:06 +01:00
parent b374b496df
commit 066d0051f2
1 changed files with 0 additions and 16 deletions

@ -30,8 +30,6 @@ class MyApp(App):
grid.add_widget(Button(text='Check Primes',
on_press=self.cpu_bound))
grid.add_widget(Button(text='Check async def',
on_press=self.async_def))
self.status = Label(text='Status')
grid.add_widget(self.status)
return grid
@ -48,20 +46,6 @@ class MyApp(App):
for n, prime in zip(PRIMES, prime_flags))
self.status.text = text
async def async_def(self, *_):
t = time.time()
self.status.text = "calculating..."
prime_flags = []
for n in PRIMES:
result = await is_prime(n)
prime_flags.append(result)
print(time.time() - t)
text = '\n'.join("%s: %s" % (n, prime)
for n, prime in zip(PRIMES, prime_flags))
self.status.text = text
if __name__ == '__main__':
MyApp().run()
```