如何使Entry窗口小部件常量不可更改

时间:2019-05-28 19:49:23

标签: python tkinter

我想修正第一次输入并锁定在输入小部件中的值

from tkinter import *
root = Tk()

root.geometry("600x500")

def Loop(create_box):
    Box=[['Box1','Box2','Box3'],['Box4', 'Box5', 'Box6'],['Box7', 'Box8', 'Box9']]
    for i in range(3):
        for j in range(3):
            Box[i][j] = StringVar();

    count=0
    for i in range(3):
        for j in range(3):
            create_box[count] = Entry(root,textvariable=Box[i][j],width=2)
            create_box[count].grid(row=i, column=j);
            count+=1
    def Output():
        #Define a loop where when you click next it should show the value fixed which
        #you entered previously
        Loop(create_box)
    Next = Button(root,text="Next",command=Output)
    Next.grid(row = 5, column=5)
    return create_box;
create_box = {};
Loop(create_box);

想要一个输出,使第一次输入的值下次不能更改。

0 个答案:

没有答案