1 回答
TA贡献1805条经验 获得超9个赞
您可以使用 Text() 而不是 Entry()。Text() 大小很容易改变。
from tkinter import *
def send_message():
print('sent')
def clear_text():
print('cleared')
#window object
app = Tk()
# Sender
Sender_text = StringVar()
Sender_label = Label(app, text='Sender', font=('bold', 14), pady=20)
Sender_label.grid(row=0, column=0, sticky=W)
Sender_entry = Entry(app, textvariable=Sender_text)
Sender_entry.grid(row=0, column=1)
# Receiver
Receiver_text = StringVar()
Receiver_label = Label(app, text='Receiver', font=('bold', 14))
Receiver_label.grid(row=0, column=2, sticky=W)
Receiver_entry = Entry(app, textvariable=Receiver_text)
Receiver_entry.grid(row=0, column=3)
# Message
Message_text = StringVar()
Message_label = Label(app, text='Message', font=('bold', 14))
Message_label.grid(row=1, column=0, sticky=W)
#Message_entry = Entry(app, textvariable=Message_text)
Message_entry = Text(app, width=20, height=2, font=("Bold",20))
Message_entry.grid(row=1, column=1)
# Buttons
send_btn = Button(app, text='Send', width=12, command=send_message)
send_btn.grid(row=2, column=0, pady=20)
clear_btn = Button(app, text='Clear', width=12, command=clear_text)
clear_btn.grid(row=2, column=1)
app.title('SMS')
app.geometry('430x145')
#start
app.mainloop()
添加回答
举报