I assume you've got the time checking bits working and you're just asking 
about updating the widget.

Firstly, updating the Clock is a bit harder as it's got an internal timer 
which is constantly updating the display. The clock widget has two 
parameters which may be relevant: "format" which controls the time 
formatting and "fmt" which is just set to "{}" so it will just display the 
formatted time. 

Now, to update widgets from inside your config, you can do this:

from libqtile import qtile

clock = qtile.widgets_map["clock"]
# You now have access to the clock widget and all its internals
clock.update("Message here")  # NB this will be overwritten with the next 
update call from the clock

Same approach can be used for a TextBox

from libqtile import qtile

textbox = qtile.widgets_map["textbox"]  # You can pass the `name` value 
when initialising widgets in your Bar. The default is the classname in 
lower case so you'll need to add names if you have more than one textbox.


If you need more help, can you post a discussion on github please. It's 
impossible to format code nicely in google groups!
On Thursday, 14 October 2021 at 14:36:28 UTC+1 [email protected] wrote:

>
> I tried to create a function which checks what time of day it is. This 
> function simply returns a string depending on time of day.
> Now what I want to do is use this function to update the Clock or Textbox 
> widget when a certain time of day is hit, but this means that this function 
> should be called on Clock.update() or similar? Is this possible? I tried 
> using InteractiveCommandClient, but I am pretty sure this is not the way
>

-- 
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/3de2a11e-db90-4bbf-a44c-deaf5893d4dcn%40googlegroups.com.

Reply via email to