我在ModuleLayout中应用ModuleMaker规则时尝试指定InputMaker Button的文本。但是,当我运行程序时,没有文字出现(即#34; Yo")。来源似乎工作正常,但文字不是。
<InputMaker@Button>:
text: self.text
pos: self.pos
size: self.size
background_normal:'./images/modone.png'
<ModuleMaker>:
size: 150, 150
source: self.source
text: self.text
canvas:
Ellipse:
pos: self.pos
size: self.size
source: self.source
InputMaker:
id: btnone
text: self.text
pos: self.parent.pos
<ModuleLayout>:
moduleone: one
moduletwo: two
modulethree: three
ModuleMaker:
id: one
center_y: root.center_y
x: root.x +300
source: './images/modone.png'
text: "YO"
ModuleMaker:
id: two
center_y: root.center_y
x: root.x+400
source: './images/modtwo.png'
ModuleMaker:
id: three
center_y: root.center_y
x: root.x+500
source: './images/modthree.png'
答案 0 :(得分:1)
当您确实要绑定到root.text时,您的InputMaker规则会引用self.text。