Is it possible to sort 0:5 to frame 1, and sort 5:10 to frame 2 using one list? Now it is clicking both radiobuttons in frame 1 and 2. I would like that only one can be selected at the time.
My code:
import tkinter as tk
from tkinter import *
List1 = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
List2 = List1[ 5: ]
List1 = List1[ :5 ]
window = Tk()
window.geometry( "300x300" )
x = tk.IntVar()
x.set( 'none' )
frame_1 = LabelFrame( window, text="Label Frame 1" )
frame_2 = LabelFrame( window, text="Label Frame 2" )
frame_1.grid( row=0, column=0, sticky='nsew' )
frame_2.grid( row=0, column=1, sticky='nsew' )
for index in range( len(List1) ):
radiobutton = Radiobutton( frame_1, text = List1[index], variable = x, value = index)
radiobutton.pack( anchor = 'nw' )
for index in range( len(List2) ):
radiobutton = Radiobutton( frame_2, text = List2[index], variable = x, value = index )
radiobutton.pack( anchor = 'nw' )
window.columnconfigure( (0, 1), weight = 1, uniform = 'a' )
window.rowconfigure( (0), weight = 1 )
window.mainloop()