Open yoboy1102 opened 1 day ago
Here is the fixed code:
import customtkinter as ctk
web = ctk.CTk()
def CBcheck_val(p, q):
print(p, q)
# There is much more to do with these values
eco_buss = ctk.CTkFrame(web,
width=185-8, height=320,
corner_radius=25,
fg_color='white',
bg_color='transparent',
)
eco_buss.grid(row=0, column=0, padx=4, pady=20)
n, m = 4, 6
let_list = [' A', 'B ', ' C ', 'D ', ' E', ' F ']
var = ctk.IntVar()
eco_rad = []
k, l = 0, 0
for i in range(m):
ff = 0
let_new = let_list[0:n]
let_new.insert(int(n/2), ' ')
for j in range(n):
var = ctk.IntVar(eco_buss)
ff += 1.4
radd = ctk.CTkCheckBox(eco_buss,
corner_radius=8, fg_color='#3DCCB2', text=None,
variable=var,
onvalue=1,
border_color='#3DCCB2', checkbox_height=43, checkbox_width=33,
height=20, width=0, command=lambda i=i, j=j: CBcheck_val(i, j))
radd.grid(row=i+1, column=int(ff-1), padx=3, pady=10)
web.mainloop()
I cannot thank you enough brother(/sister), this is legit so simple yet mindbreaking to me, Thanks so much, this will help in a lot of my gui designs, feel dumb to not thought of this, TY
This isnt completely a custom tkinter problem/help, but I cannot figure out a way to Assign specific values to each of the many checkboxes I have created
Each Time Tick a checkbox it gives the same values of i and j which are the last updated values of them ofc, Now how do I get specific values for each values bakc, here I am just printing them but I need them for much more, How can I assign those specific values each button has, Thanks