【发布时间】:2021-05-24 16:06:06
【问题描述】:
我正在尝试使用 kivy 和 Python 来开发一个带有滑块的快速应用程序,其中必须先使用滑块来确定设置,然后单击“提交”,然后将所需的图像加载到应用程序窗口中。
我目前在我的 .kv 文件中有单独插入按钮和图像的示例,但我不确定如何连接它们:
BoxLayout:
orientation:'vertical'
size: root.width,root.height
font_size: 20
padding: 100
spacing: 10
Button:
text: 'press me'
on_press: print("ouch! More gently please")
on_release: print("ahhh")
on_state:
#print("my current state is {}".format(self.state))
size_hint: (0.3,0.3)
Image:
source: 'images\IMG_6980.jpg'
#allow_stretch: True
#keep_ratio: True
pos_hint: {'center_x':0.7}
我觉得我需要对 on_press 声明做点什么,但我不太确定是什么。任何帮助表示赞赏。
【问题讨论】:
标签: python user-interface kivy kivy-language