我正在做一个发送电子邮件的gui程序。我想添加一个条目(我代码中的messageEntry)来输入信息。我想改变它的高度,这样信息就不必在一行中输入了(我想有文本包装)。我试着使用ipady,它确实调整了条目的大小,但信息仍然只能在一行中输入(在条目的中间)。以下是我的代码。
def sendMail(senderEmail, senderPassword):
global server
sendMailFont = ['Consolas', 10]
sendMailWindow = Tk()
sendMailWindow.title("Sendmail")
sendMailWindow.resizable(False, False)
sendMailWindow.focus_force()
# sendMailWindow.iconbitmap('info icon.ico')
sendMailWindow.config(bg = "#DCDCDC")
loggedInLabel = Label(sendMailWindow, font = (sendMailFont), text = "Logged in as {}".format(senderEmail), bg = "#DCDCDC")
loggedInLabel.grid(row = 0, column = 0)
subjectLabel = Label(sendMailWindow, font = (sendMailFont), text = "Subject", bg = "#DCDCDC")
subjectLabel.grid(row = 2, column = 0, sticky = "w")
subjectEntry = Entry(sendMailWindow, font = (sendMailFont), bg = "#FFFFFF", width = 37)
subjectEntry.grid(row = 3, column = 0, sticky = "w", ipady = 2)
messageLabel = Label(sendMailWindow, font = (sendMailFont), text = "Message", bg = "#DCDCDC")
messageLabel.grid(row = 5, column = 0, sticky = "w")
messageEntry = Entry(sendMailWindow, font = (sendMailFont), bg = "#FFFFFF", width = 37)
messageEntry.grid(row = 6, column = 0, sticky = "w")
hiddenLabel = Label(sendMailWindow, font = ('Consolas', 1), text = "", bg = "#DCDCDC")
hiddenLabel.grid(row = 1, column = 0, sticky = "we")
hiddenLabel = Label(sendMailWindow, font = ('Consolas', 10), text = "", bg = "#DCDCDC")
hiddenLabel.grid(row = 4, column = 0, sticky = "we")
sendMailWindow.mainloop()