python - Passing text from textinput to label in Kivy -


i trying textinput widget pass text callback function makes label text when called printbutton, should simple when think it. have habit of not seeing wood trees. anyhoo, if can figure out code :p

import kivy kivy.require('1.5.1') kivy.app import app kivy.uix.label import label kivy.uix.button import button kivy.uix.gridlayout import gridlayout kivy.uix.textinput import textinput  class kivyentrywidget(gridlayout):      def __init__(self, **kwargs):         super(kivyentrywidget, self).__init__(**kwargs)         self.cols = 2         self.add_widget(label(text='what want print?'))         self.text_input = textinput(multiline=false)         self.add_widget(self.text_input)         self.printbutton = button(text='print')         self.printbutton.bind(on_press=callback)         self.add_widget(self.printbutton)      def callback(self):         return label(text=self.text_input.text)    class firstapp(app):     def build(self):         return kivyentrywidget()  if __name__ == '__main__':     firstapp().run() 

def callback(self,evt=none): #not sure if kivy sends event info added optional arg in case     return self.add_widget(label(text=self.text_input.text)) 

maybe ... not overly familiar kivy think ..

also

self.printbutton.bind(on_press=self.callback) 

should fix other problem


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -