【发布时间】:2020-03-29 23:45:05
【问题描述】:
我想创建一个简单的小部件,它是一个进度条,当我们用鼠标左键单击它时,它的值设置为 1。
local myFirstWidget = wibox.widget {
{
value = 0.5,
color = "#ff0000",
widget = wibox.widget.progressbar,
width = 100,
forced_height = 20,
shape = gears.shape.rounded_bar,
border_width = 2,
border_color = beautiful.border_color,
ticks = true,
clip = true,
margins = {top = 5, bottom = 5},
paddings = 2
},
layout = wibox.layout.fixed.horizontal
}
myFirstWidget:connect_signal("button::press",
function(w, _, _, btn) w.value = 1 end)
当我按下栏时 - 什么都没有发生。如果我使用
w.set_value(1)
然后点击栏显示错误
尝试调用一个零值(字段'set_value')
如何让它发挥作用?
【问题讨论】:
-
不确定但可能是
w:set_value -
尝试一下,我想通了,检查我对问题的回答@macroland
标签: lua awesome-wm