25 lines
561 B
Python
25 lines
561 B
Python
|
|
from random import randint
|
||
|
|
|
||
|
|
from kivy.app import App
|
||
|
|
from kivy.uix.boxlayout import BoxLayout
|
||
|
|
|
||
|
|
|
||
|
|
class RanNum(BoxLayout):
|
||
|
|
pass
|
||
|
|
|
||
|
|
|
||
|
|
class RanKivApp(App):
|
||
|
|
def build(self):
|
||
|
|
return RanNum()
|
||
|
|
|
||
|
|
def generate_random_number(self):
|
||
|
|
try:
|
||
|
|
upper_boundary = int(self.root.ids.upper_boundary_input.text)
|
||
|
|
self.root.ids.output.text = str(randint(1, upper_boundary))
|
||
|
|
except ValueError:
|
||
|
|
self.root.ids.output.text = 'Bitte nur positive,\nganze Zahlen eingeben!'
|
||
|
|
|
||
|
|
|
||
|
|
if __name__ == '__main__':
|
||
|
|
RanKivApp().run()
|