An app for getting width, length, and price and calculating results
In this I have 3 entries and one button that will click on that information to be calculated instead of labels
E.g :
1 --> Input1 , Input2 , Input3 all is in float
2 --> Press Button to Calculate i have multiple answers and multiple labels
How can set result in labels ?
[App ui in graphical test (real verison in debug mode on andriod)][1] [1]: https://i.sstatic.net/byNwG.jpg
Main.py
import kivy
kivy.require('1.0.7')
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import NumericProperty
from kivy.uix.textinput import TextInput
class root(BoxLayout):
def __init__(self, **kwargs):
super(root, self).__init__(**kwargs)
def cal(self):
print(int(self.ertefa.input_text))
pass
class HeroApp(App):
kv_directory = 'template1'
def build(self):
return root()
if __name__ == '__main__':
HeroApp().run()
<hr>
kv File:
#:kivy 1.0
<root>:
BoxLayout:
orientation:'vertical'
Image:
source:'top.png'
allow_stretch: True
size_hint: 1 , None
# -------------------------------------------
GridLayout:
id:'inputs"
rows:3
col:2
size_hint: 1, .4
padding : 5
# INPUT ---[ ERTEFA ASLI ]---------------------------
TextInput:
id: ertefaa
input_filter : 'float'
multiline: False
font_size: 42
text: ''
Image:
source:'img1.png'
# INPUT ---[ ARZ ASLI ]------------------------------
TextInput:
id: arzz
input_filter : 'float'
Image:
source:'img2.png'
# INPUT ---[ GHEYMAT ]--------------------------------
TextInput:
id: gheymatt
input_filter : 'float'
Image:
source:'img3.png'
# PROC --[ Def Button ]------------------------------
Button:
size_hint: 1, .15
text: 'TURSAN CALLCULATE'
on_press : ertefaa - 6
# ----------------------------------------------------
GridLayout:
id: 'outputs'
rows:9
col:2
padding : 5
# OUTPUT ---[ ERTEFA FRAME ]--------------------------
Label:
id : ertefaframe
text: '213'
color:[10,1,255,1]
font_size : 26
Image:
source:'out1.png'
# OUTPUT ---[ ARZ FRAME ]--------------------------
Label:
id : arzframe
text: '213'
font_size : 26
Image:
source:'out2.png'
# OUTPUT ---[ MOTAHAREK ]--------------------------
Label:
id : motaharek
text: '213'
font_size : 26
Image:
source:'out3.png'
# OUTPUT ---[ ERTEFA TUR ]------------------------
Label:
id : erteftur
text: '213'
font_size : 26
Image:
source:'out4.png'
# OUTPUT ---[ GAM TUR ]---------------------------
Label:
id : gamtur
text: '213'
font_size : 26
Image:
source:'out5.png'
# OUTPUT ---[ METRE MORABA ]------------------------
Label:
id : metr
text: '213'
font_size : 26
Image:
source:'out6.png'
# OUTPUT ---[ GHEYMAT KOLL ]------------------------
Label:
id: gheymatkoll
text: '213'
font_size : 26
Image:
source:'out7.png'
# INFO ---[ ADDRESS ]------------------------
Image:
source:'down.png'
size_hint: 1, None
From kivy documentation:
text
Text of the label.
Creation of a simple hello world:
widget = Label(text='Hello world')
If you want to create the widget with an unicode string, use:
widget = Label(text=u'My unicode string')
text is a StringProperty and defaults to ‘’.
If you want to change the text of a specific label, simply retrieve by using its id, and then set the desired text:
self.ids.id_of_label_you_want_to_change.text = "Text you want to set"