[英]Add Widget to Tkinter colorchooser
As far as I understand, it is not possible to modify the tkinter.colorchooser.askcolor
as it uses the systems colorpicker dialog.据我了解,无法修改tkinter.colorchooser.askcolor
,因为它使用系统颜色选择器对话框。 Is this true?这是真的?
from the source code: https://github.com/python/cpython/blob/3.9/Lib/tkinter/colorchooser.py来自源代码: 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.
The reason being is I wish to add an entry box to the dialog so that I would get the color code and user-entered text returned.原因是我希望在对话框中添加一个输入框,以便获得返回的颜色代码和用户输入的文本。 Maybe it is possible to embed the dialog within a larger window?也许可以将对话框嵌入到更大的 window 中? Is something like this possible, without using multiple windows?在不使用多个 windows 的情况下,这样的事情是否可能?
I cannot find previous discussion anywhere else so I guess it is not a simple issue.我在其他任何地方都找不到以前的讨论,所以我想这不是一个简单的问题。
As far as I understand, it is not possible to modify the tkinter.colorchooser.askcolor as it uses the systems colorpicker dialog.据我了解,无法修改 tkinter.colorchooser.askcolor,因为它使用系统颜色选择器对话框。 Is this true?这是真的?
Yes, that is true.是的,这是真的。 At least on Windows and OSX.至少在 Windows 和 OSX 上。 On Linux it's a custom dialog written in tcl/tk .在 Linux 上,它是一个用 tcl/tk 编写的自定义对话框。 You could start with that code and then make modifications to it, then write a tkinter wrapper around it.您可以从该代码开始,然后对其进行修改,然后围绕它编写一个 tkinter 包装器。 That wouldn't be particularly difficult if you know tcl/tk, but it's not exactly trivial either.如果您知道 tcl/tk,那将不会特别困难,但这也不是微不足道的。
Maybe it is possible to embed the dialog within a larger window?也许可以将对话框嵌入到更大的 window 中?
No, it's not.不,这不对。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.