ttk.Entry.select_range() works with Button, but not ttk.Button in python / tkinter?
Question: Can some one please explain why entry.select_range() works with a Button, but
not a ttk.Button?

    
    
    from tkinter import *
    from tkinter import ttk
    
    root = Tk()
    
    entry = ttk.Entry(root)
    entry.pack()
    
    #This works
    button = Button(root, text="Select your text", command=lambda:
                        entry.select_range(0, END))
    
    #but this doesn't
    ##button = ttk.Button(root, text="Select your text", command=lambda:
    ##                    entry.select_range(0, END))
    
    button.pack()
    
    root.mainloop()
    


Answer: This answer from [Google
Group](https://groups.google.com/d/msg/comp.lang.tcl/SplAe3PFLUM/4edvWpGqeyMJ)
says,

> However, _on Windows_ (only) the selection will only become visible when the
> entry gets the focus.

and also this page about [ttk
button](http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/ttk-Button.html)
says,

> By default, a ttk.Button will be included in focus traversal ... To remove
> the widget from focus traversal, use takefocus=False

So you need to add takefocus option to `ttk.Button`.

    
    
    button = ttk.Button(root, takefocus=False, text=...)
    

