[Tkinter-discuss] radiobutton initial selection

Michael Lange klappnase at web.de
Tue Jan 30 11:49:50 CET 2007

On Mon, 29 Jan 2007 23:41:03 +0000 (UTC)
Howard Lightstone <howard at eegsoftware.com> wrote:

> I am trying to get a radiobutton without an indicator to show selection 
> state.  Calling .invoke() in the widget causes all the callback things to 
> happen but ...
> The button does NOT show the 'selected' state like it does if I click on 
> the button with the mouse.
> .select() and .invoke() do not seem to change this display issue.
> Is there another way to get the select highlighting (sunken button) to 
> happen?
> I am using 2.2.3 (with Tk 8.3) but it works the same way with 2.5 (and tk 
> 8.4.14).
> Is this a tk bug?   It looks like _tkinter just passes on arguments to tk 
> with minimal processing.

Hi Howard,

It works well for me, can you show us some of your code that does not work?
The code snippet that worked for me:

>>> from Tkinter import *
>>> r=Tk()
>>> s=StringVar()
>>> s.set('1')
>>> r1=Radiobutton(r, text='1', value='1', variable=s)
>>> r1.pack()
>>> r2=Radiobutton(r, text='2', value='2', variable=s)
>>> r2.pack()
>>> r2.select()
>>> r1.select()


More information about the Tkinter-discuss mailing list