Still running… in multiple files, with global font_size…
This commit is contained in:
44
.idea/workspace.xml
generated
44
.idea/workspace.xml
generated
@@ -4,15 +4,11 @@
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="3745efb7-4727-49d7-a776-8798725fc688" name="Changes" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/.idea/inspectionProfiles/profiles_settings.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/modules.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/ran_kiv.iml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/rankiv.kv" afterDir="false" />
|
||||
<list default="true" id="3745efb7-4727-49d7-a776-8798725fc688" name="Changes" comment="It’s running! Yeah!">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/main.py" beforeDir="false" afterPath="$PROJECT_DIR$/main.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/rankiv.kv" beforeDir="false" afterPath="$PROJECT_DIR$/rankiv.kv" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/rannum.py" beforeDir="false" afterPath="$PROJECT_DIR$/rannum.py" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@@ -31,14 +27,15 @@
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"Python.main.executor": "Run",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "master"
|
||||
<component name="PropertiesComponent"><![CDATA[{
|
||||
"keyToString": {
|
||||
"Python.main.executor": "Run",
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "master",
|
||||
"settings.editor.selected.configurable": "preferences.lookFeel"
|
||||
}
|
||||
}</component>
|
||||
}]]></component>
|
||||
<component name="RunManager">
|
||||
<configuration name="main" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
|
||||
<module name="ran_kiv" />
|
||||
@@ -54,7 +51,7 @@
|
||||
<option name="ADD_CONTENT_ROOTS" value="true" />
|
||||
<option name="ADD_SOURCE_ROOTS" value="true" />
|
||||
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/main.py" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="PARAMETERS" value="--size=360x740" />
|
||||
<option name="SHOW_COMMAND_LINE" value="false" />
|
||||
<option name="EMULATE_TERMINAL" value="false" />
|
||||
<option name="MODULE_MODE" value="false" />
|
||||
@@ -79,6 +76,19 @@
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1714247286737</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="It’s running! Yeah!">
|
||||
<option name="closed" value="true" />
|
||||
<created>1714421527721</created>
|
||||
<option name="number" value="00001" />
|
||||
<option name="presentableId" value="LOCAL-00001" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1714421527721</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="2" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="It’s running! Yeah!" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="It’s running! Yeah!" />
|
||||
</component>
|
||||
</project>
|
||||
21
main.py
21
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__':
|
||||
|
||||
10
rankiv.kv
10
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
|
||||
font_size: app.font_size
|
||||
13
rannum.py
13
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!'
|
||||
|
||||
Reference in New Issue
Block a user