在不改变按钮位置的情况下更改 tkinter 中文本框的大小
你好,请帮我看看我的代码如下
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()
输出如下: This is my output
你能帮忙显示下面的按钮吗??
答案 0 :(得分:1)
尝试将所有按钮放在这样的框架中:
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()