私はインターネットで自分の問題を解決しようとしました。しかし、結果はまったくありません。 だから。このコードサンプルをご覧下さい:今kivyラベルの位置の違い
class RootWidget(FloatLayout):
def __init__(self, **kwargs):
super(RootWidget, self).__init__(**kwargs)
btn = Button(text='Hello world')
btn.size_hint = (1, .3)
btn.pos_hint = {'top':1}
title = Label(text=('[color=ff3333]Hello world[/color]'),
font_size=str(12) + 'sp', markup=True)
self.add_widget(title)
self.add_widget(btn)
title.texture_update()
title.text_size = (Window.width, None)
title.height = title.texture_size[1]
with title.canvas:
Color(1., 1., 0)
Rectangle(size=title.size, pos=title.pos)
print(title.size)
print(title.pos)
print(title.texture_size)
と画像を見て:
誰が、なぜ印刷(title.pos)を教えてもらえます(0,0)と言う、キャンバスの描画四角形(0,0)で、テキストは別の位置に表示されますか?
私はすでにこれを圧倒しました
は...ありがとうございます。
それは仕事ですが、size_hintを設定した後、 'title.texture_update()'という行が1行あります。私はもっとkivyのドキュメントを読むでしょう。ご協力ありがとうございます。 – stPhoenix