英文:
How to resize an Entry Box by height in Tkinter?
问题
有没有一种简便的方法来增加Tkinter Entry对象的高度,就像在代码中所示:
website_entry = Entry(width=35,bg="#001C30",fg="white")
website_entry.grid(column=1,row=1,columnspan=2)
website_entry.focus()
尝试使用以下方法:
widget.place(x=int,y=int,width=int,height=int)
但是这会导致与.grid方法一起使用时出现错误。
英文:
is there any short method to increase the height of website_entry Tkinter Entry object as in code -
> website_entry = Entry(width=35,bg="#001C30",fg="white")
> website_entry.grid(column=1,row=1,columnspan=2)
> website_entry.focus()
tried using
widget.place(x=int,y=int,width=int,height=int)
but it creates error to be created with .grid method
答案1
得分: 0
很抱歉,目前没有办法直接告诉Entry组件按你所需的方式增加高度。该组件的高度由字体大小决定。你可以像这样更改字体和字体大小:
website_entry = Entry(width=35, bg="#001C30", fg="white", font=('Arial', 40))
请注意,你可以选择任何你想要的字体,不一定非要是Arial。更一般地说:
font=('font_name', font_size)
英文:
Unfortunately there's no way to explicitly tell the Entry to increase in height as you have. The height of the box is dictated by the font size. You can change the font and font size like this:
website_entry = Entry(width=35,bg="#001C30",fg="white", font=('Arial', 40))
Note that you can pick any font that you want, it doesn't have to be Arial.
More generally:
font=('font_name', font_size)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论