Python 在tkinter中使用Text()创建表是否有最大行数和列数

Python 在tkinter中使用Text()创建表是否有最大行数和列数,python,tkinter,Python,Tkinter,我已尝试根据以下代码创建一个表。但是,可以创建表,就好像存在最大行*列限制一样。当我写18*18时,可以创建一个表,也可以创建18*19。但是当我写一个19*19表时,程序只是在等待。18*19是342,19*19是361。也可以快速创建15*23表,但当我键入15*24时,程序再次等待。当行*列大于350时,结果相同。有解决这个问题的办法吗 from tkinter import * class Application: def __init__(self): s

我已尝试根据以下代码创建一个表。但是,可以创建表,就好像存在最大行*列限制一样。当我写18*18时,可以创建一个表,也可以创建18*19。但是当我写一个19*19表时,程序只是在等待。18*19是342,19*19是361。也可以快速创建15*23表,但当我键入15*24时,程序再次等待。当行*列大于350时,结果相同。有解决这个问题的办法吗

from tkinter import *


class Application:
    def __init__(self):

        self.window = Tk()
        self.window.title("Database")
        self.window.resizable(width=False, height=False)

        self.canvas = Canvas(borderwidth=0)
        self.frame_1 = Frame(self.canvas, bg="black")
        self.scrollbar_1 = Scrollbar(orient="vertical", command=self.canvas.yview)
        self.scrollbar_2 = Scrollbar(orient="horizontal", command=self.canvas.xview)

        self.canvas.configure(yscrollcommand=self.scrollbar_1.set, xscrollcommand=self.scrollbar_2.set)
        self.scrollbar_1.pack(side="right", fill="y")
        self.scrollbar_2.pack(side="bottom", fill="x")
        self.canvas.pack(side="left", fill="both", expand=True)
        self.canvas.create_window((4, 4), window=self.frame_1, anchor="nw")
        self.frame_1.bind("<Configure>", self.onFrameConfigure)

        self.menubar = Menu(tearoff=0)

        self.table()
        self.menu()
        self.mainloop = self.window.mainloop()

    def table(self):
        row = int(input("Row:"))
        column = int(input("Column:"))
        for i in range(row):
            for j in range(column):
                text = Text(self.frame_1, width=20, height=1)
                text.bind("<Button-3>", self.popup)
                text.grid(row=i, column=j, padx=1, pady=1)
                text.configure(state="disabled")

    def menu(self):
        self.menubar.add_command(label="Copy", command=lambda: self.window.focus_get().event_generate('<<Copy>>'))

    def popup(self, event):
        self.menubar.post(event.x_root, event.y_root)

    def onFrameConfigure(self, event):
        self.canvas.configure(scrollregion=self.canvas.bbox("all"))


example = Application()  
从tkinter导入*
班级申请:
定义初始化(自):
self.window=Tk()
self.window.title(“数据库”)
self.window.reshable(宽度=False,高度=False)
self.canvas=canvas(borderwidth=0)
self.frame_1=frame(self.canvas,bg=“黑色”)
self.scrollbar_1=scrollbar(orient=“vertical”,command=self.canvas.yview)
self.scrollbar_2=滚动条(orient=“horizontal”,command=self.canvas.xview)
self.canvas.configure(yscrollcommand=self.scrollbar_1.set,xscrollcommand=self.scrollbar_2.set)
self.scrollbar_1.pack(side=“right”,fill=“y”)
self.scrollbar_2.pack(side=“bottom”,fill=“x”)
self.canvas.pack(side=“left”,fill=“both”,expand=True)
self.canvas.create_window((4,4),window=self.frame_1,anchor=“nw”)
self.frame_1.bind(“,self.onFrameConfigure)
self.menubar=菜单(tearoff=0)
self.table()
self.menu()
self.mainloop=self.window.mainloop()
def表(自身):
行=int(输入(“行:”)
column=int(输入(“列:”)
对于范围内的i(行):
对于范围内的j(列):
文本=文本(self.frame_1,宽度=20,高度=1)
text.bind(“,self.popup)
网格(行=i,列=j,padx=1,pady=1)
text.configure(state=“disabled”)
def菜单(自我):
self.menubar.add_命令(label=“Copy”,command=lambda:self.window.focus_get().event_generate(“”))
def弹出窗口(自身、事件):
self.menubar.post(event.x_root,event.y_root)
def onFrameConfigure(自我,事件):
self.canvas.configure(scrollregion=self.canvas.bbox(“全部”))
示例=应用程序()

19x19适合我。100x100也可以工作,尽管创建10000个文本小部件需要大约2秒的延迟。20x20一眨眼就能工作。15x24也很好用。我能够创建一个50x50。我认为你的系统只是缺乏动力!:我也尝试过100x100,但时间太长了,所以我强制我的IDE退出程序。我的工作电脑不是很强大。你说“当我输入15*24”是什么意思?该程序只需要一个数字。你的意思是说你要为行输入
15
,为列输入
24
?哦,这是我的蹩脚英语。我想说我写了15行和24列,但我说了15*24我的道歉<代码>self.window.update()。那些书面声明告诉你了什么?