0

I am using at Tkinter tix Checklist in my python script. Whenever an checklist items status is toggled, I want that a callback is invoked.

A checklist is created like this:

cl = CheckList(root, browsecmd=foo, command=bar )

According to documentation browsecmd is invoked when selecting an item in the checklist via clicking or using arrow keys and command is invoked when an item is checked or unchecked via double-click or pressing return-key. If you do a single leftmouse click, then only browsecmd will be invoked, however the item status changes from checked to unchecked or vice versa, too.

Is it possible to change checklist's behaviour in a way that command is also invoked via a single mouse click? Or is it a bug that I can change checked-status of an item via mouse-click and 'command' call is not invoked, but it was supposed to do so.

As far as I know, binding Button-1 event direktly to 'bar' is not an option, because it will not decide between a click on an items checkbox and a click on the collapse/uncollapse buttons of the hlist widget.

Hatatister
  • 962
  • 6
  • 11
  • 1
    BTW some [Docs for 3.6](http://docs.w3cub.com/python~3.6/library/tkinter.tix/) say to not use tix and to use ttk instead as tix is no longer maintains. – Mike - SMT Sep 15 '17 at 20:05
  • 1
    Call `command` from `browsecmd`? – Terry Jan Reedy Sep 15 '17 at 22:03
  • I agree with @TerryJanReedy Could you not simply call `bar` within `foo`? – Ethan Field Sep 18 '17 at 09:49
  • I thought about this, too. The problem is that browscmd can't distinguish between selecting an item and toggling the checkbox of an item. So browsecmd may be invoked even if the item was not checked/unchecked. – Hatatister Sep 19 '17 at 21:07
  • Because of sierra mountain tech's hint that tic is depracted, I decided to use a modified version of this approach https://stackoverflow.com/a/40293197/7483073 , which uses ttk instead of tix – Hatatister Sep 19 '17 at 21:18

0 Answers0