On Saturday, 11 July 2020 01:54:55 UTC+12, Tycho Andersen wrote:
>
>
> def my_update(qtile):
> w = qtile.widgets_map["thing_to_update"]
> w.tick()
>
> Key(..., lazy.function(my_update))
>
Thank you! That works perfectly. :)
For any other noobs who stumble across this and want to do the same thing:
You can reference the widget using the lowercase name of the widget class.
In my case, I use GenPollText, so I would use for eg:
def my_update(qtile):
w = qtile.widgets_map["genpolltext"]
w.tick()
Key(
[mod], "a",
lazy.function(my_update),
)
But what if you have more than one GenPollText widget? The code above will
only update the first instance. To get around this, add the name property
to each widget config, eg:
top = bar.Bar([
widget.GenPollText(
name = myWidget1
func = myFunc_1,
),
widget.GenPollText(
name = myWidget2
func = myFunc_2,
),
...
You can then reference each widget by its name. Eg to update the second
widget the function becomes:
def my_update(qtile):
w = qtile.widgets_map["myWidget2"]
w.tick()
--
You received this message because you are subscribed to the Google Groups
"qtile-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/qtile-dev/b6a33c32-8ed4-4700-8c31-36d43ec9f5dfo%40googlegroups.com.