所以这是我的noob代码和问题-按钮上没有文本。为什么?如果我添加标签文本仍然不显示。 在Carousel类中,文本通常被添加。。。 我找到的唯一解决方法是在按钮顶部添加标签(但我不喜欢这个想法)
from kivy.lang import Builder
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.relativelayout import RelativeLayout
from kivy.app import App
from kivy.uix.carousel import Carousel
Builder.load_string('''
<MainClass>:
BoxLayout:
pos_hint: {"x": 0, "y": .85}
Button:
text: "saasas"
on_press: root.next()
Button:
text: "saasas"
Button:
text: "PREV"
on_press: root.prev()
<Carousel>:
size_hint: 1, .6
BoxLayout:
Button:
text: "Asas"
Button:
Button:
GridLayout:
cols:2
Button:
Button:
Button:
Button:
''')
class Add(BoxLayout):
pass
class MainClass(RelativeLayout):
def __init__(self):
RelativeLayout.__init__(self)
self.car = Carousel()
self.add_widget(self.car)
def next(self, *args):
print('next')
def prev(self, *args):
pass
class Test(App):
def build(self):
return MainClass()
Test().run()
我不知道为什么会这样。。。在
这是实际的窗口:
目前没有回答
相关问题 更多 >
编程相关推荐