gpt4 book ai didi

python - 将小部件添加到 Tkinter 颜色选择器

转载 作者:行者123 更新时间:2023-12-04 19:06:52 26 4
gpt4 key购买 nike

据我了解,无法修改 tkinter.colorchooser.askcolor因为它使用系统颜色选择器对话框。这是真的?
来自源代码:https://github.com/python/cpython/blob/3.9/Lib/tkinter/colorchooser.py

# this module provides an interface to the native color dialogue
# available in Tk 4.2 and newer.
原因是我希望在对话框中添加一个输入框,以便获得返回的颜色代码和用户输入的文本。也许可以将对话框嵌入更大的窗口中?在不使用多个窗口的情况下,这样的事情是否可能?
我在其他任何地方都找不到以前的讨论,所以我想这不是一个简单的问题。

最佳答案

As far as I understand, it is not possible to modify the tkinter.colorchooser.askcolor as it uses the systems colorpicker dialog. Is this true?


是的,这是真的。至少在 Windows 和 OSX 上。在 Linux 上是 custom dialog written in tcl/tk .您可以从该代码开始,然后对其进行修改,然后围绕它编写一个 tkinter 包装器。如果您知道 tcl/tk,那将不会特别困难,但这也不是微不足道的。

Maybe it is possible to embed the dialog within a larger window?


不,这不对。

关于python - 将小部件添加到 Tkinter 颜色选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66807311/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com