tkinter python入口高度 [英] tkinter python entry height

查看:122
本文介绍了tkinter python入口高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个简单的应用程序来练习python,在其中我要像记事本一样编写文本.但是,我不能扩大我的条目.我为此使用tkinter.有人知道如何增加条目的高度吗?

I'm making a simple app just to practice python in which I want to write text as if it were Notepad. However, I can't make my entry bigger. I'm using tkinter for this. Does anybody know how to make the height of an entry bigger?

我尝试过这样的事情:

f = Frame()
f.pack()
e = Entry(f,textvariable=1,height=20)
e.pack()

我知道这不起作用,因为没有"height"属性.但是,我看到有一个width属性.

I know this doesn't work because there isn't a property of "height". However, I see that there is a width property.

推荐答案

听起来您正在寻找 tkinter.Text ,可让您同时调整小部件的高度和宽度.下面是一个简单的脚本来演示:

It sounds like you are looking for tkinter.Text, which allows you to adjust both the height and width of the widget. Below is a simple script to demonstrate:

from tkinter import Text, Tk

r = Tk()
r.geometry("400x400")

t = Text(r, height=20, width=40)
t.pack()

r.mainloop()

这篇关于tkinter python入口高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆