Sorry for all the messages. 

Having looked at the source on github, I don't know if this is a long term 
solution as the button_press function no longer seems to pass the qtile 
object. According to the commit 
<https://github.com/qtile/qtile/commit/55f92b22b346ccd8a4c3e1867080bc82dbcaf33b#diff-932dbeefdf2b3d64837a8571334e72328fd8580e50c453de2c5652ade6e2d3b6>
 
the correct way to access the qtile object is to import "libqtile.qtile".

On Saturday, 17 October 2020 at 19:09:59 UTC+1 elParaguayo wrote:

> OK - had some success.
>
> It looks like the main qtile object has a list of the active widgets which 
> we need to access. It also looks like that running the callback passes the 
> qtile object as an argument. As a result, your callback function could look 
> like this:
>
> def change_text(qtile):
>      qtile.widgets_map["textbox"].update("Updated Text")
>
> On Saturday, 17 October 2020 at 19:04:51 UTC+1 elParaguayo wrote:
>
>> I agree it's not particularly obvious. I haven't seen anything in the 
>> docs about this.
>>
>> I'm not sure the InteractiveCommandClient is the right way to do this 
>> (and I think that "lazy" is actually just an instance of this).
>>
>> If I bind this to a key:
>> lazy.widget["textbox"].update("xyz")
>> it works.
>>
>> However, if I put it in a callback function it doesn't.
>>
>> I'll have a play around and see if I can figure it out (or someone more 
>> experienced can reply before then!).
>>
>> On Sat, 17 Oct 2020 at 17:47, rickroller <[email protected]> wrote:
>>
>>>
>>> Thanks for the reply.
>>>
>>> I actually did try it with and without the braces. Qtile reloads fine, 
>>> vscode doesn''t show any errors but the textbox just doesn't update.  Here 
>>> is the snippet. 
>>>
>>> def change_text():
>>>     c=InteractiveCommandClient()
>>>     c.widget['textbox'].update('replaced_text')
>>>
>>> screens=[
>>> Screen(
>>>      bottom=bar.Bar(widget.TextBox('text', mouse_callbacks={'Button1' : 
>>> change_text}
>>> )
>>>
>>> It just doesn't change on mouse click. What are the other ways to access 
>>> widgets and update them in config.py?
>>>
>>>
>>> On Saturday, October 17, 2020 at 9:46:24 PM UTC+5:30 elParaguayo wrote:
>>>
>>>> I've never used the InteractiveCommandClient but I would think you need 
>>>> to create an instance of it first before trying to update the widget i.e.
>>>>
>>>> from libqtile.command_client import InteractiveCommandClient
>>>> c=InteractiveCommandClient()
>>>> c.widget['textbox'].update('xyz') 
>>>>
>>>> Note the "()" at the end of the second line.
>>>>
>>>> If it doesn't work, what error messages do you get?
>>>>
>>>>
>>>> On Sat, 17 Oct 2020 at 14:05, rickroller <[email protected]> wrote:
>>>>
>>>>>
>>>>> I wanted to update the TextBox widget every 5 minutes through the 
>>>>> output of a script. I tried 
>>>>>
>>>>> from libqtile.command_client import InteractiveCommandClient
>>>>> c=InteractiveCommandClient
>>>>> c.widget['textbox'].update('xyz')  
>>>>>
>>>>> For people without more than a basic knowledge of python, its very 
>>>>> tough to understand the basic skeleton of how this works. I know, its on 
>>>>> me. But can anyone please help?  
>>>>>   
>>>>>
>>>>> -- 
>>>>> 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/2a7f2150-462e-4673-9d99-f09ce0c0888bn%40googlegroups.com
>>>>>  
>>>>> <https://groups.google.com/d/msgid/qtile-dev/2a7f2150-462e-4673-9d99-f09ce0c0888bn%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>>> .
>>>>>
>>>> -- 
>>> 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/8029133e-5834-47de-a9ee-fcdfc6d45d37n%40googlegroups.com
>>>  
>>> <https://groups.google.com/d/msgid/qtile-dev/8029133e-5834-47de-a9ee-fcdfc6d45d37n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>>

-- 
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/b7979ecb-7c18-41df-9697-dffb4d4268efn%40googlegroups.com.

Reply via email to