Python中文
首页
教程
问答
标签
搜索
登录
注册
如何在Tkinter中设置元素的精确高度?
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>请帮助修复代码:</p> <pre><code>import Tkinter as tkinter root = tkinter.Tk() root.geometry("340x470") row5 = tkinter.Frame(root) row5.pack(side = 'top', fill = 'x') label5 = tkinter.Label(row5, text = 'Audio', width = 10, anchor='e') label5.pack(side = 'left') entry5 = tkinter.Text(row5, height = '4') entry5.pack(side = 'right', fill = 'x', expand = 'yes') row6 = tkinter.Frame(root, borderwidth = 10, height = 20, bg = 'red') row6.pack(side = 'top', fill = 'x') button = tkinter.Button(row6, text = 'Send', height = 20, width = 20, relief = 'raised', cursor = 'hand1', font = ('times', 14, 'bold')) button.pack() root.mainloop() </code></pre> <p>问题是我要求“row6”高度为20,而屏幕高度远远大于20</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>按钮中的“height”值测量的是文本行,而不是像素。所以你要求一个足够高的盒子来画20行文字。尝试将其减少到1或2:</p> <pre><code>button = tkinter.Button(row6, text = 'Send', height = 2, width = 20, relief = 'raised', cursor = 'hand1', font = ('times', 14, 'bold')) </code></pre>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
jupyter运行一个旧的pytorch版本
7 回答
Jupyter运行不同版本的卸载库?
4 回答
Jupyter运行指定的键盘快捷键
5 回答
Jupyter通过.local文件“逃逸”virtualenv。我该如何缓解这种情况?
1 回答
Jupyter重新加载自定义样式
9 回答
Jupyter错误:“没有名为Jupyter_core.paths的模块”
5 回答
jupyter错误:无法在随机林中将决策树视为png
3 回答
Jupyter错误'内核似乎已经死亡,它将自动重新启动'为一个给定的代码块
8 回答
Jupyter错误地用阿拉伯语和字母数字元素显示Python列表
8 回答
Jupyter隐藏数据帧索引,但保留原始样式
7 回答
Jupyter集线器:启动器中出现致命错误。。。系统找不到指定的文件
3 回答
Jupyther中相同值的相同哈希,但导出到Bigquery时不相同
7 回答
Jupy上Python的读/写访问问题
2 回答
jupy上没有模块cv
4 回答
Jupy上的排序错误
10 回答
Jupy中bqplot图形的紧凑布局
9 回答
Jupy中matplotlib plot的连续更新
4 回答
Jupy中Numpy函数的文档
9 回答
Jupy中Pandas的自动完成问题
9 回答
jupy中Qt后端的Matplotlib动画
3 回答