I am trying to display some output in the corresponding text input boxes but when I click on the update button output should be in the left Input box that's working but when I click on Updatee button output is displayed on left text input box itself(it overwrites whatever is there in the left input area).
When I click on Updatee it should display in the right box and when update is clicked output should be in the left input box or area. And same with the clear function which is clearing only the left box I want it to clear both. Also I want only one button i.e. just Update to display in the corresponding boxes.
This is the Python file:
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
class DemoGridLayout(GridLayout):
def update(self, query):
if query:
a = query + str("Area 1")
self.display.text = a
def updatee(self, query):
if query:
a = query + str("Area 2")
self.display.text = a
def clear(self):
self.display.text = ""
class DemoApp(App):
def build(self):
return DemoGridLayout()
demoApp = DemoApp()
demoApp.run()
Kivy File(as demo.kv) :
<CustButton@Button>:
font_size: 28
<DemoGridLayout>:
id:test
display:entry
rows:3
cols:2
padding:10
spacing:10
BoxLayout:
TextInput:
id: entry
font_size:20
multiline:True
BoxLayout
TextInput:
id: entrye
font_size:20
multiline:True
CustButton:
id: b1
size_hint_y:0.1
text:"Update"
on_press:test.update(entry.text)
CustButton:
id: b2
size_hint_y:0.1
text:"Updatee"
on_press:test.updatee(entrye.text)
CustButton:
size_hint_y:0.1
size_hint_x:0.5
text:"Clear"
on_press:test.clear()