[Tutor] tk Radiobutton example

Peter Otten __peter__ at web.de
Mon Feb 15 04:48:34 EST 2016

paul.hermeneutic at gmail.com wrote:

> +I am working through "Python GUI Programming Cookbook" by Burkhard Meier.
> https://www.packtpub.com/application-development/python-gui-programming-cookbook
> On page 20, the variable curRad is set to a string then to a
> Radiobutton. What is the purpose of setting curRad to a string?
> for col in range(3): # 3
>     curRad = 'rad' + str(col)
>     curRad = tk.Radiobutton(win, text=colors[col], variable=radVar,
> value=col, command=radCall)
>     curRad.grid(column=col, row=5, sticky=tk.W)

In the code above the line

>     curRad = 'rad' + str(col)

has no effect. You can safely remove it.

If you care you can check if this is already in the errata, and submit it 
here if it isn't:


More information about the Tutor mailing list