[英]Change The size of the Text box in tkinter without changing the buttons place
Change The size of the Text box in tkinter without changing the buttons place在不更改按钮位置的情况下更改 tkinter 中文本框的大小
Hello, can you please help me my code is the following你好,你能帮我吗我的代码如下
from tkinter import *
window = Tk()
# create your first row
l1 = Label(window,text="Title")
l1.grid(row=0,column=0)
e1= Entry(window)
e1.grid(row=0,column=1)
l2 = Label(window,text="Author")
l2.grid(row=0,column=2)
e2= Entry(window)
e2.grid(row=0,column=3)
#second row
l2 = Label(window,text="Year")
l2.grid(row=1,column=0)
e3= Entry(window)
e3.grid(row=1,column=1)
l3 = Label(window,text="ISBN")
l3.grid(row=1,column=2)
e3= Entry(window)
e3.grid(row=1,column=3)
# create your butts diplayther in the 3th column after the 1st row
b_view = Button(window,text="View ALL", width = 12)
b_view.grid(row=2, column=3)
b_search = Button(window,text="Search Entry", width= 12)
b_search.grid(row=3, column=3)
b_add = Button(window,text = "Add Entry", width=12)
b_add.grid(row=4, column=3)
b_update = Button(window,text="Update Selected", width=12)
b_update.grid(row=5, column=3)
b_delete = Button(window,text = "Delete Selected",width=12)
b_delete.grid(row=6, column = 3)
b_close = Button(window,text= "Close", width =12)
b_close.grid(row=7, column = 3)
#create your output
out = Text(window,height=6 ,width=14)
out.grid(row=4 ,column=0)
window.mainloop()
The output is the following: This is my output output 如下:这是我的 output
Can you please help to display the buttons one below from another??你能帮忙显示一个下面的按钮吗?
Try putting all of the buttons in a frame like this:尝试将所有按钮放在这样的框架中:
buttons_frame = Frame(window)
buttons_frame.grid(row=2, column=3, rowspan=5)
b_view = Button(buttons_frame, text="View ALL", width=12)
b_view.pack()
b_search = Button(buttons_frame, text="Search Entry", width=12)
b_search.pack()
b_add = Button(buttons_frame, text="Add Entry", width=12)
b_add.pack()
b_update = Button(buttons_frame, text="Update Selected", width=12)
b_update.pack()
b_delete = Button(buttons_frame, text="Delete Selected",width=12)
b_delete.pack()
b_close = Button(buttons_frame, text="Close", width=12)
b_close.pack()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.