Python 3.5 Tkinter How to separate 2 sets of radio buttons
<p>My first question here.</p>

<p>I'm currently writing a GUI with Tkinter in Python 3.5.</p>

<p>I have a settings frame in my application and I have radio buttons to let the user change them. There is no problem when I have only one set of radio buttons but when I add a second set of radio buttons, Python thinks that they all belong to the same set and the user can pick only one of the 6 radio buttons (I want the user to be able to pick a total of two, 1 for each set). Is there a way to tell Tkkinter/Python that there are 2 sets of radio buttons? I searched Stack Overflow with a few keywords, but most of the questions are about how to get values from radio buttons and none of them answer my question.</p>

<p>Here is a example code of radio buttons, to help you imagine the situation:</p>

<pre><code>import tkinter as tk
#I'm not writing things like frames or stuff, this is just to
#tell you how my radio buttons are categorized

#I want these to be separate:
s1r1=tk.Radiobutton(root,text="Red") #Set 1-Radiobutton 1
s1r2=tk.Radiobutton(root,text="Green") #Set 1-Radiobutton 2
s1r3=tk.Radiobutton(root,text="Blue") #Set 1-Radiobutton 3
#than these:
s2r1=tk.Radiobutton(root,text="1") #Set 2-Radiobutton 1
s2r2=tk.Radiobutton(root,text="2") #Set 2-Radiobutton 2
s2r3=tk.Radiobutton(root,text="3") #Set 2-Radiobutton 3
</code></pre>

<p>Thanks a lot!</p>

<p>You didn't bind two different variables to your button groups. Each <code>Radiobutton</code> group has to be associated with a single <code>StringVar()</code> or <code>IntVar()</code>.</p>

<pre><code>v1 = tk.StringVar()
v2 = tk.StringVar()
# Group 1
s1r1=tk.Radiobutton(root,text="Red", variable=v1)
s1r2=tk.Radiobutton(root,text="Green", variable=v1)
s1r3=tk.Radiobutton(root,text="Blue", variable=v1)
# Group 2
s2r1=tk.Radiobutton(root,text="1", variable=v2)
s2r2=tk.Radiobutton(root,text="2", variable=v2)
s2r3=tk.Radiobutton(root,text="3", variable=v2)
</code></pre>

python tkinter radio-button