import kivy from kivy.app import App from kivy.uix.label import Label from kivy.uix.gridlayout import GridLayout from kivy.uix.textinput import TextInput from kivy.uix.button import Button class MainScreen(GridLayout): def __init__(self,**kwargs): super(MainScreen,self).__init__(**kwargs) self.cols = 1 self.insideGrid = GridLayout() self.insideGrid.cols = 2 self.insideGrid.add_widget(Label(text="Text1: ")) self.text1 = TextInput(multiline=False) self.insideGrid.add_widget(self.text1) self.insideGrid.add_widget(Label(text="Text2: ")) self.text2 = TextInput(multiline=False) self.insideGrid.add_widget(self.text2) self.add_widget(self.insideGrid) self.buttonName = Button(text="ButtonText", font_size = 40) self.buttonName.bind(on_press=self.pressed) self.add_widget(self.buttonName) def pressed(self, instance): text1 = self.text1.text text2 = self.text2.text print("text1: {}, text2: {}".format(text1,text2)) self.text1.text = "" self.text2.text = "" class MyApp(App): def build(self): return MainScreen() if __name__ == "__main__": MyApp().run()