Hi Arsenii,

The thing you put in the lazy.function call has to be callable object (that
takes the qtile object as a single parameter). You can wrap your function
call in a lambda so you can have it get the right args.

Sean

On Sat, Aug 19, 2017, 13:15 Arsenii Riazantsev <[email protected]>
wrote:

>
> <https://lh3.googleusercontent.com/-33e4O7lNuX0/WZhxMaDUutI/AAAAAAAAARY/9xAVw67pH6EyRPV7S7JpOv4AJS-jfqSwgCLcBGAs/s1600/Untitled.png>
> Hey, thanks for your help. I tried, but maybe my implementation is
> incorrect. Is it enough to show just a screenshot? There is the widget's
> method on the left side and the config part on the right.
>
> On Thursday, August 17, 2017 at 2:10:17 AM UTC+2, Tycho Andersen wrote:
>>
>> Hi Arsenii,
>>
>> On Wed, Aug 16, 2017 at 03:10:58PM -0700, Arsenii Riazantsev wrote:
>> > Hi, everyone!
>> >
>> > I am new to Python.I would like to make one custom widget and to call
>> one
>> > of it's method after pressing a key. I tried to import "Key" class and
>> to
>> > bind the button with the method, but it doesn't work. Is it not
>> possible to
>> > implement such a bind at all? Maybe there is another way to do it?
>>
>> Try,
>>
>> def foo(qtile):
>>     qtile.widgetMap['yourwidget'].your_method()
>>
>> keys = [
>>     ...
>>     Key([mod], "k", lazy.function(foo)),
>> ]
>>
>> Cheers,
>>
>> Tycho
>>
> --
> 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].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to