python - 如何查找 **options 参数是什么?

标签 python python-3.x tkinter pycharm

我正在使用 tkinter。当我想了解有关方法的更多信息时,我会进入他们的库。

i.e. from tkinter import filedialog

我正在研究的方法之一是:

def askdirectory (**options):
    "Ask for a directory, and return the file name"
    return Directory(**options).show()

我知道 **options 参数意味着它接受任意数量的参数和/或关键字参数。

我不明白如何查找该方法的 options 参数。我尝试更深入地研究方法类,但我迷失了该往哪里看。

我希望能够通过阅读库代码来找到参数是什么,这样我就可以将其应用于更快地阅读和理解其他 python 库。

最佳答案

您不会很幸运地从代码本身获取选项。 Tkinter 是 tcl/tk 解释器的包装器,许多选项只是通过 tkinter 传递到底层 tcl 解释器。

可用选项的权威文档来源可以在 tcl/tk 手册页中找到:http://tcl.tk/man/tcl8.5/TkCmd/contents.htm

关于python - 如何查找 **options 参数是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45739886/

相关文章:

python - 从基于登录的网站抓取数据时如何避免被禁止?

python - const 引用在 Python 中的等价物是什么?

python - 如何使用 Tkinter 模块在 Python 中创建用户登录部分

python - Tkinter session 在退出时仍处于事件状态?

python-3.x - Python matplotlib : add count number on top of the bar

python - 如何解决ValueError?

python - 多重继承和多级继承的区别

Python - 在类中声明属性的惯例是什么?

python - 在Python GUI中绑定(bind)返回键

python - 如何使用掩码在多个维度中替换 python numpy 数组中的值?