禁用按钮/禁用选项菜单的tkinter颜色 [英] tkinter color of disabled buttons / disabled optionmenus

查看:205
本文介绍了禁用按钮/禁用选项菜单的tkinter颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为Unity(Ubuntu)创建快速列表编辑器. (初始)界面包含禁用的选项菜单按钮(右下方为"+",编辑按钮为右上方)和禁用的普通"按钮. 但是,tkinter不能平等地对待这两种禁用图标.禁用的选项菜单图标比正常"的禁用按钮图标要暗一些. 除了复杂的解决方法之外,是否有解决方案,可以在禁用事件上仅用图像替换图标?

I am working on a quicklist editor for Unity (Ubuntu). The (initial) interface contains both disabled optionmenu buttons (right down, the "+", and the edit button, upper right) and disabled "normal" buttons. tkinter however does not treat both kinds of disabled icons equally; the disabled optionmenu icons are somewhat darker than the "normal" disabled button icons. Is there a solution for this, other than a complicated workaround, replacing the icons with just images, on disable-events?

推荐答案

....事实证明,没有其他解决方案,而不是使用DISABLED状态,将按钮替换为完全不具有按钮功能的其他图像,只要该按钮应被禁用即可.尽管它需要几行额外的编码,但它也使您可以控制禁用按钮的外观.同时,我认为禁用 option 按钮与其他禁用按钮的颜色略有不同是一种错误.

....It turns out there is no other solution than, instead of using the DISABLED state, replacing the button with another image with no button functionality at all, for as long as the button is meant to be disabled. Although it takes a few lines of extra coding, it also gives you the benefit of control on how the disabled button looks. At the same time, I think it is kind of a bug that disabled option buttons are of slightly different color than other disabled buttons.

这篇关于禁用按钮/禁用选项菜单的tkinter颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆