2017-07-05 13 views

答えて

0

C[0]戻りAとC[1]戻るB

はC(の.py)から

from kivy.app import App 
from kivy.base import Builder 
from kivy.properties import NumericProperty, ReferenceListProperty 
from kivy.uix.boxlayout import BoxLayout 

Builder.load_string(""" 
<rootwi>: 
    Button: 
     text: 'print A via ReferenceListProperty' 
     on_press: print(root.C[0]) 
    Button: 
     text: 'print B via ReferenceListProperty' 
     on_press: print(root.C[1]) 
""") 
class rootwi(BoxLayout): 
    A = NumericProperty(1) 
    B = NumericProperty(2) 
    C = ReferenceListProperty(A, B) 


class MyApp(App): 
    def build(self): 
     return rootwi() 

if __name__ == '__main__': 
    MyApp().run() 


class MyApp(App): 
    def build(self): 
     return rootwi() 

if __name__ == '__main__': 
    MyApp().run() 
をAとBを印刷し、あなたの値を持つ小さな例アプリであります
関連する問題