嗨,我正在Tkinter中创建一个UI,这是我用来创建UI的代码
self.master = master
top_frame2 = Frame(master, bg='cyan', width=700, height=550)
top_frame2.grid(row=0,sticky='nsew')
top_frame2.grid_propagate(0)
text=Text(top_frame2)
text1=Text(top_frame2)
vsb = Scrollbar(top_frame2, orient="vertical")
vsb1 = Scrollbar(top_frame2, orient="vertical")
label1=Label(top_frame2,text="Original Output Files Path",bg='cyan')
label2=Label(top_frame2,text="Application Output Files Path",bg='cyan')
label4=Label(top_frame2,text="Select the Igoned Path File, should be .TXT",bg='cyan')
label5=Label(top_frame2,text="XPATH For File 1",bg='cyan')
label6=Label(top_frame2,text="XPATH For File 1",bg='cyan')
entry1=Entry(top_frame2)
entry2=Entry(top_frame2)
entry4=Entry(top_frame2)
entry5=Entry(top_frame2)
entry6=Entry(top_frame2)
button1=Button(top_frame2,text="Browse",fg="black",command=lambda:self.update1(entry1))
button2=Button(top_frame2,text="Browse",fg="black",command=lambda:self.update2(entry2))
button4=Button(top_frame2,text="Browse",fg="black",command=lambda:self.update4(entry4))
button5=Button(top_frame2,text="Submit",fg="black",command=lambda:self.thread1(entry1,entry2,entry3,entry4,text))
label1.grid(row=1,sticky=W,column=0)
label2.grid(row=2,sticky=W,column=0)
label4.grid(row=4,sticky=W,column=0)
label5.grid(row=6,sticky=W,column=0)
label6.grid(row=6,sticky=W,column=1)
entry1.grid(row=1,column=1)
entry2.grid(row=2,column=1)
entry4.grid(row=4,column=1)
entry5.grid(row=7,column=0)
entry6.grid(row=7,column=1)
button1.grid(row=1,column=2)
button2.grid(row=2,column=2)
button4.grid(row=4,column=2)
button5.grid(row=8,columnspan=3)
text.grid(row=9,column=0)
text1.grid(row=9,column=2)
现在我的要求是文本网格应并排显示,但是第一个文本小部件占据了整个空间 image description here 要求您检查图像。
所以我的问题是,有什么方法可以限制文本小部件的大小,以便可以将两个小部件并排安装。