commit e3f032507ef27cb6ad3ce85cc27c2e92bcb4619f Author: Jan Bertram Date: Mon Apr 29 22:12:07 2024 +0200 It’s running! Yeah! diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..bbb84de --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f0f51d1 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/ran_kiv.iml b/.idea/ran_kiv.iml new file mode 100644 index 0000000..2c80e12 --- /dev/null +++ b/.idea/ran_kiv.iml @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..a1a784f --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + { + "associatedIndex": 8 +} + + + + + { + "keyToString": { + "Python.main.executor": "Run", + "RunOnceActivity.OpenProjectViewOnStart": "true", + "RunOnceActivity.ShowReadmeOnStart": "true", + "git-widget-placeholder": "master" + } +} + + + + + + + + + + + + + + + + 1714247286737 + + + + \ No newline at end of file diff --git a/main.py b/main.py new file mode 100644 index 0000000..ab8d073 --- /dev/null +++ b/main.py @@ -0,0 +1,24 @@ +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() diff --git a/rankiv.kv b/rankiv.kv new file mode 100644 index 0000000..1e57d6f --- /dev/null +++ b/rankiv.kv @@ -0,0 +1,29 @@ +: + BoxLayout: + orientation: 'vertical' + Label: + text: 'Zufallszahl von 1 bis ?' + font_size: sp(24) + TextInput: + id: upper_boundary_input + multiline: False + halign: 'center' + font_size: 24 + size_hint: .8, None + height: 42 + hint_text: 'Gib eine Zahl ein!' + input_filter: 'int' + pos_hint: {'x': .1} + Label: + size_hint: None, .2 + Button: + text: 'Generate!' + font_size: 24 + size_hint: .5, None + pos_hint: {'x': .25} + on_release: app.generate_random_number() + Label: + id: output + text: 'Meine Zufallszahl' + halign: 'center' + font_size: 24 \ No newline at end of file diff --git a/rannum.py b/rannum.py new file mode 100644 index 0000000..e69de29