diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a1a784f..b08744f 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,15 +4,11 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
@@ -31,14 +27,15 @@
- {
- "keyToString": {
- "Python.main.executor": "Run",
- "RunOnceActivity.OpenProjectViewOnStart": "true",
- "RunOnceActivity.ShowReadmeOnStart": "true",
- "git-widget-placeholder": "master"
+
+}]]>
@@ -54,7 +51,7 @@
-
+
@@ -79,6 +76,19 @@
1714247286737
+
+
+ 1714421527721
+
+
+
+ 1714421527721
+
+
+
+
+
+
\ No newline at end of file
diff --git a/main.py b/main.py
index ab8d073..44ee896 100644
--- a/main.py
+++ b/main.py
@@ -1,23 +1,14 @@
-from random import randint
-
from kivy.app import App
-from kivy.uix.boxlayout import BoxLayout
-
-
-class RanNum(BoxLayout):
- pass
+from kivy.properties import NumericProperty
+from rannum import RanNum
class RanKivApp(App):
- def build(self):
- return RanNum()
+ font_size = NumericProperty(24)
- 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!'
+ def build(self):
+ self.ran_num = RanNum()
+ return self.ran_num
if __name__ == '__main__':
diff --git a/rankiv.kv b/rankiv.kv
index 1e57d6f..6976a8d 100644
--- a/rankiv.kv
+++ b/rankiv.kv
@@ -3,12 +3,12 @@
orientation: 'vertical'
Label:
text: 'Zufallszahl von 1 bis ?'
- font_size: sp(24)
+ font_size: app.font_size
TextInput:
id: upper_boundary_input
multiline: False
halign: 'center'
- font_size: 24
+ font_size: app.font_size
size_hint: .8, None
height: 42
hint_text: 'Gib eine Zahl ein!'
@@ -18,12 +18,12 @@
size_hint: None, .2
Button:
text: 'Generate!'
- font_size: 24
+ font_size: app.font_size
size_hint: .5, None
pos_hint: {'x': .25}
- on_release: app.generate_random_number()
+ on_release: app.ran_num.generate_random_number()
Label:
id: output
text: 'Meine Zufallszahl'
halign: 'center'
- font_size: 24
\ No newline at end of file
+ font_size: app.font_size
\ No newline at end of file
diff --git a/rannum.py b/rannum.py
index e69de29..8cea11e 100644
--- a/rannum.py
+++ b/rannum.py
@@ -0,0 +1,13 @@
+from random import randint
+from kivy.uix.boxlayout import BoxLayout
+
+
+class RanNum(BoxLayout):
+ pass
+
+ def generate_random_number(self):
+ try:
+ upper_boundary = int(self.ids.upper_boundary_input.text)
+ self.ids.output.text = str(randint(1, upper_boundary))
+ except ValueError:
+ self.ids.output.text = 'Bitte nur positive,\nganze Zahlen eingeben!'