From e3f032507ef27cb6ad3ce85cc27c2e92bcb4619f Mon Sep 17 00:00:00 2001 From: Jan Bertram Date: Mon, 29 Apr 2024 22:12:07 +0200 Subject: [PATCH] =?UTF-8?q?It=E2=80=99s=20running!=20Yeah!?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inspectionProfiles/profiles_settings.xml | 6 ++ .idea/misc.xml | 7 ++ .idea/modules.xml | 8 ++ .idea/ran_kiv.iml | 10 +++ .idea/vcs.xml | 6 ++ .idea/workspace.xml | 84 +++++++++++++++++++ main.py | 24 ++++++ rankiv.kv | 29 +++++++ rannum.py | 0 9 files changed, 174 insertions(+) create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/ran_kiv.iml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml create mode 100644 main.py create mode 100644 rankiv.kv create mode 100644 rannum.py 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