我想创建一个代码,该代码将基于.txt文件中的文本制作多个复选框,并使按钮上的文本以及该部分正常工作,但是要检查是否选中了一个复选框,我需要能够调用它,所以他们需要名字,我不知道该怎么做。代码看起来像这样。
image = PhotoImage(file='C:/Users/plarkin2020334/Pictures/DQ_Logocp.png')
def __init__(self, parent, *args, **kwargs):
tkinter.Frame.__init__(self, parent, *args, **kwargs)
Label(self, image=self.image).place(relx=0, rely=0, anchor=NW)
Label(self, text="Check When Complete:", background="#3f49e5").place(relx=0, rely=.18, anchor=NW)
global lines, f, count
self.a=0
b=.22
for _ in range(count):
#this has to loop and make the checkboxes below have names
Checkbutton(self, text=lines[self.a]).place(relx=0, rely=b, anchor=NW)
self.a=self.a+1
b=b+.06
Button(self, text="Done", style="C.TButton", command=self.done()).place(relx=0, rely=b+.01, anchor=NW)
def done(self):
global varp
#if checkboxes are checked then do below
FrameMon1.pack_forget(self)
run1()
varp = varp * 0