【发布时间】:2020-06-09 09:36:21
【问题描述】:
目标:
- 使用 FloatLayout 将标签锚定到左下角。
预期结果:
- 标签必须位于左下角,单行。
实际结果:
- 标签在左下角,但它是双线的。
参考代码:
class ScreenThree(Screen):
def __init__(self, **kwargs):
super(ScreenThree, self).__init__(**kwargs)
self.video1 = Video(source="somevideo.mpg")
float_layout = FloatLayout()
self.label1 = Label(text="Just a place holder video", opacity=0, pos_hint={"x": 0, "bottom": 1}, size_hint=[0.1, 0.1])
self.label1.texture_size = self.label1.size
self.label1.text_size = self.label1.texture_size
self.label1.halign = "center"
self.label1.valign = "center"
self.add_widget(float_layout)
float_layout.add_widget(self.label1)
float_layout.add_widget(self.video1, index=1)
self.video1.opacity = 0
def on_enter(self):
self.video1.allow_stretch = True
self.video1.state = "play"
self.label1.opacity = 1
Clock.schedule_once(self._adjust_opacity, 2)
def _adjust_opacity(self, *dt):
self.video1.opacity = 1
参考图片:
非常感谢您的阅读。
【问题讨论】:
-
只是想知道!你想为我的游戏赢得荣誉吗?谢谢!
标签: python python-3.x label kivy python-3.7