Which widget do you use for a Excel like table in tkinter?(您在 tkinter 中将哪个小部件用于类似 Excel 的表格?)
问题描述
我想在 tkinter 中为我正在编写的 gui 提供一个类似 Excel 的表格小部件.你有什么建议吗?
I want a Excel like table widget in tkinter for a gui I am writing. Do you have any suggestions?
推荐答案
Tktable 至少是如果您需要全桌支持,可以说是最好的选择.简而言之,以下示例展示了如何使用它,假设您已经安装了它.示例是针对python3的,但是对于python2只需要修改import语句即可.
Tktable is at least arguably the best option, if you need full table support. Briefly, the following example shows how to use it assuming you have it installed. The example is for python3, but for python2 you only need to change the import statement.
import tkinter as tk
import tktable
root = tk.Tk()
table = tktable.Table(root, rows=10, cols=4)
table.pack(side="top", fill="both", expand=True)
root.mainloop()
Tktable 可能难以安装,因为没有可安装 pip 的软件包.
Tktable can be difficult to install since there is no pip-installable package.
如果您真正需要的是用于显示和编辑数据的小部件网格,您可以轻松构建条目或标签小部件网格.例如,请参阅 this answer 问题 蟒蛇.GUI(输入和输出矩阵)?
If all you really need is a grid of widgets for displaying and editing data, you can easily build a grid of entry or label widgets. For an example, see this answer to the question Python. GUI(input and output matrices)?
这篇关于您在 tkinter 中将哪个小部件用于类似 Excel 的表格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:您在 tkinter 中将哪个小部件用于类似 Excel 的表格?


基础教程推荐
- 筛选NumPy数组 2022-01-01
- 使用PyInstaller后在Windows中打开可执行文件时出错 2022-01-01
- 何时使用 os.name、sys.platform 或 platform.system? 2022-01-01
- 用于分类数据的跳跃记号标签 2022-01-01
- 线程时出现 msgbox 错误,GUI 块 2022-01-01
- 如何在海运重新绘制中自定义标题和y标签 2022-01-01
- Dask.array.套用_沿_轴:由于额外的元素([1]),使用dask.array的每一行作为另一个函数的输入失败 2022-01-01
- 如何让 python 脚本监听来自另一个脚本的输入 2022-01-01
- Python kivy 入口点 inflateRest2 无法定位 libpng16-16.dll 2022-01-01
- 在 Python 中,如果我在一个“with"中返回.块,文件还会关闭吗? 2022-01-01