[英]Is it possible to get tkinter messagebox icon image files?
I'm developing a python/tkinter application, and finding the default messagebox lacked flexibility, I programmed my own using Toplevel
. 我正在开发python / tkinter应用程序,并且发现默认消息框缺乏灵活性,因此我使用
Toplevel
编写了自己的程序。 I was rather successful in recreating the messabox appearance, however, I could not find a way to obtain the icons displayed in normal tkinter messagebox (ie : error, warning, info icons...) 我在重新创建消息框外观方面相当成功,但是,我找不到一种方法来获取普通tkinter消息框中显示的图标(即:错误,警告,信息图标...)
I did some research didn't find much, except that those image were stored in a win32 DLL file... Also tried looking into the tkinter messagebox module code, but its only an interface transferring from python to TCL code I can't find (and probably wouldn't be able to read anyway...) 我做了一些研究并没有发现太多,除了那些图像存储在win32 DLL文件中...还尝试查看tkinter消息框模块代码,但是它只是从python到TCL代码的接口(而且可能还是无法阅读...)
Is there anyway to get files or rough equivalents ( PhotoImage
objects) for these icons using either python or TCL executed though Tk().tk.call()
? 无论如何,是否使用通过
Tk().tk.call()
执行的python或TCL来获取这些图标的文件或大致等效的图片( PhotoImage
对象Tk().tk.call()
? Or any other (thourghly explained then) way to achieve this? 或任何其他方法(稍后会详细解释)来实现这一目标?
Right now the best solution I can think of is to use screencapture, and save the icons to files, but I'd rather be able to access the original ones... 现在我能想到的最好的解决方案是使用屏幕捕获,并将图标保存到文件中,但是我希望能够访问原始的...
Thanks in advance ! 提前致谢 !
The rough equivalents are available as (tk global variables): 大致的等价项可以用作(tk全局变量):
::tk::icons::warning
::tk::icons::error
::tk::icons::information
::tk::icons::question
Like anything that is not documented, it is subject to change in the future, but these should be stable. 像任何未记录的内容一样,它将来可能会发生变化,但是这些应该是稳定的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.