Python Tkinter文本大小

2024-10-02 16:33:17 发布

您现在位置:Python中文网/ 问答频道 /正文

我才开始学习如何构建gui。有没有办法设置文本框的大小? 我试图使用.geometry,但它是错误的:

from Tkinter import *

root = Tk()
root.title("boop")
root.geometry("500x700")

app = Frame(root)
app.grid()

msg = Text(app)
# msg.geometry("500x50") - this is what i tried, and was wrong.
msg.grid()

root.mainloop()

Tags: fromimportapptitletkinter错误guimsg
1条回答
网友
1楼 · 发布于 2024-10-02 16:33:17

这可以通过使用heightwidth选项来完成:

# I just picked 50 and 500 to demonstrate
# You can tweak it to your needs
msg = Text(app, height=50, width=500)

相关问题 更多 >