2016-04-28 45 views

回答

0

一個例子是here連同說明。您沒有提供任何代碼或基本上什麼我可以使用,所以我會做這種方式:

<Box>: 
    TextInput: 
     id: mytextinput 
     multiline: True ## defaults to True, but so you could see how it works 
     text: 'something' 
    Button: 
     on_release: root.update_text('new value') 

這將是你KV文件/ String在textInput無論身在何處,你就會把它和id是如何訪問控件識別器,然後在蟒蛇

class Box(BoxLayout): 
    def update_text(self, value): 
     self.ids.mytextinput.text = value 

這意味着你擁有的任何部件和TextInput是其在KV文件/串兒,你要訪問它通過ids字典,並改變其可變text在您的班級中撥打自定義update_text(<string>)以達到您想要的價值。

相關問題