我不知道为什么在尝试操作 tkinter 小部件的变量时会出错:
AttributeError: 'str' object has no attribute 'pack'
我试图创建一系列条目名称,所以如果我的基本名称是 A,下一个名称将是: A_1 ,A_2,A_3 .....这是我的代码需要帮助
def generate_fieldes(x):
generated_frame='frame1_'+x
print generated_frame
A_generated ='A_'+x
B_generated ='B_'+x
C_generated ='C_'+x
D_generated ='D_'+x
E_generated ='E_'+x
F_generated ='F_'+x
if frame1.winfo_exists()==1:
generated_frame=Frame(tab1,height=200,width=600,bg='yellow')
A_generated = AutocompleteEntry(list, generated_frame,bd =2,width=26,justify=RIGHT)
A_generated.pack(side = RIGHT)
A_generated.focus_set()
B_generated = Entry(generated_frame, bd =2,width=12,justify=RIGHT)
B_generated.pack(side = RIGHT)
C_generated = Entry(generated_frame, bd =2,width=12,justify=RIGHT)
C_generated.pack(side = RIGHT)
D_generated = Entry(generated_frame, bd =2,width=17,justify=RIGHT)
D_generated.pack(side = RIGHT)
E_generated = Entry(generated_frame, bd =2,width=17,justify=RIGHT)
E_generated.pack(side = RIGHT)
F_generated = Entry(generated_frame, bd =2,width=20,justify=RIGHT)
F_generated.pack(side = RIGHT)
generated_frame.pack(fill=X,side=TOP)
generate_fields('1')