【发布时间】:2018-04-18 21:56:10
【问题描述】:
浮动布局中的图像索引有问题。
我需要在程序期间在布局顶部(我的意思是 Z 维度)放置一个可按下的图像(ImageButton 中的 on_press 事件,它继承自 Button 和 Image)。
有什么想法吗?我试图这样做,但我没有做到:/ 这是 kivy 代码中的 FloatLayout
FloatLayout:
pos: 0, root.height*0.101
spacing: 5
ImageButton:
id: mat
allow_stretch: True
keep_ratio: False
size_hint_x: None
size_hint_y: None
size: root.width * 0.5, self.parent.height * 0.89 * 0.5
source: 'mat.png'
pos: 0, root.height*0.11 + self.height
ImageButton:
id: geo
allow_stretch: True
keep_ratio: False
size_hint_x: None
size_hint_y: None
size: root.width * 0.5, self.parent.height* 0.89 * 0.3333
source: 'geo.png'
pos: root.width*0.5, root.height * 0.11
ImageButton:
id: human
allow_stretch: True
keep_ratio: False
size_hint_x: None
size_hint_y: None
size: root.width * 0.5, self.parent.height* 0.89 * 0.3333
pos: root.width*0.5, root.height*0.11 + self.height
source: 'human.png'
ImageButton:
id: biot
allow_stretch: True
keep_ratio: False
size_hint_x: None
size_hint_y: None
size: root.width * 0.5, self.parent.height* 0.89 * 0.3333
pos: root.width*0.5, root.height*0.11 + 2*self.height
source: 'biotech1.png'
ImageButton:
id: bio1
allow_stretch: True
keep_ratio: False
size_hint_x: None
size_hint_y: None
size: root.width * 0.5, self.parent.height* 0.89 * 0.5
pos: 0, root.height*0.11
source: 'bio1.png'
【问题讨论】:
标签: python kivy kivy-language