python中textinput_python – 在Kivy应用程序中获取textinput值
使用self.txt1,self.lbl1等.
class MyApp(App):
# layout
def build(self):
layout = BoxLayout(padding=10, orientation='vertical')
btn1 = Button(text="OK")
btn1.bind(on_press=self.buttonClicked)
layout.add_widget(btn1)
self.lbl1 = Label(text="test")
layout.add_widget(self.lbl1)
self.txt1 = TextInput(text='', multiline=False)
layout.add_widget(self.txt1)
return layout
# button click function
def buttonClicked(self,btn):
self.lbl1.text = "You wrote " + self.txt1.text
# run app
if __name__ == "__main__":
MyApp().run()
# join all items in a list into 1 big string
使用:
def buttonClicked(self,btn):
lbl1.text = "You wrote " + txt1.text
總結
以上是生活随笔為你收集整理的python中textinput_python – 在Kivy应用程序中获取textinput值的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: java scanner nextlin
- 下一篇: 三菱modbusRTU通讯实例_实例 |