Save TextInput on button press - kivy/python -


i have class button "save game", opens popup textinput widget , button save users text input. tried doesn't work. if print out filename after "modifying" it, prints out filename defined beforehand: .txt, not game1.txt or this.

class something(widget):     filename = ".txt"     # code game     def save(self,*args):         def on_text(instance, value):             return value          name = textinput(text="")         name.bind(text=on_text)         self.filename = "{}.txt".format(name.text)          b = boxlayout()         save_button = button(text="save file")         b.add_widget(save_button)         b.add_widget(name)         popup = popup(title="enter name:", content=b)          save_button.bind(on_release=popup.dismiss)         name.bind(on_text_validate=popup.on_dismiss) # wanted save when user closes popup         popup.open() 

where doing wrong? (i know won't save it, want create name here, have different class method saving it)


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -