开发者

Tkinter get tuple eror

I开发者_开发技巧'm trying to make a program that can later show the number and value of some entries list. I made it using nested loop. What I was expecting is this value: [(1,101,102,103,104), (2,105,106,107,108), (3,109,110,111,112)] when I press print button, but the number displayed is only number 2 and there is an error like this: AttributeError: 'tuple' object has no attribute 'get'. Can you help me with my code? Thank you

Here is my code:

from tkinter import *

master = Tk()
a=StringVar()
b=[]
c=[]
d=[]

for i in range(3):
    e = Entry(master, textvariable=a, state='readonly')
    e.grid(row=i,column=1,pady=5)
    
    for j in range( 4 ):
        e1= Entry(master,)
        e1.grid(row=i,column=j+2,pady=5)
        a.set(str(i))
        b.append(e1)
    c.append(e)
d.append((c,b))

but=Button(master, text='print', command= lambda:show())
but.grid(row=4, columnspan=3)

def show():
    for io in d:
        print(io.get())
        

master.mainloop()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜