0

I attempted to configure all Buttons in my app to change their takefocus option to 0 by writing this:

style = ttk.Style()
style.configure('TButton', takefocus=0)

But they still take focus.

ashir
  • 111
  • 7
  • Did you use the style when creating the button ? – Mike67 Aug 22 '20 at 12:08
  • What do you mean? isn't this supposed to configure all buttons? What am I missing here? – ashir Aug 22 '20 at 14:54
  • Check this post (https://stackoverflow.com/questions/45389166/how-to-know-all-style-options-of-a-ttk-widget) and run the code for TButton: `print(stylename_elements_options('TButton'))`. You will see `takefocus` is not a valid option for TButton – Mike67 Aug 22 '20 at 18:05
  • So if I want to set the option takefocus to 0, I have to go to every button and modify it separately or is there another way? – ashir Aug 24 '20 at 02:20
  • 1
    You may be able to create your own button class and inherit from TButton. With that you can set takefocus by default. – Mike67 Aug 24 '20 at 02:22

0 Answers0