我有:
Button:
text: "SEQUENCE 2"
size_hint: None, .16
width: 225
on_press:
self.background_color = (1.7, 0, 1.7, 1)
我希望'self.background_color'在'on_press'之后的几秒钟后恢复正常(按之前的状态)。
我该怎么做?
编辑(在.kv StackLayout中是所需位置。)
<ContScreen>:
StackLayout
orientation: "tb-rl"
spacing: 15
Button:
text: "SEQUENCE 1"
size_hint: None, .16
width: 225
Button:
text: "SEQUENCE 2"
size_hint: None, .16
width: 225
如果无法集成到.kv StackLayout中,我如何基于'<>'方法重新格式化它以使其工作。
答案 0 :(得分:0)
#:kivy 1.11.0
<ButtonBackgroundColourDemo>:
text: "SEQUENCE 2"
size_hint: None, .16
width: 225
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard let data = data, error == nil else {
return
}