2024-04-25 02:08:00 发布
网友
我想做一个下拉菜单的颜色。红绿蓝黄。我希望选项框内的单词用他们尊敬的名字来着色。因此,当用户单击箭头打开选项菜单时,选项红色将有红色字母。蓝色会有蓝色的字母等等。在
这可能吗?在
谢谢。在
所以你只需要使用OptionMenu.entryconfig(*index of item*, background = *color)
OptionMenu.entryconfig(*index of item*, background = *color)
m.entryconfig(0, background="GREEN") m.entryconfig(1, background = "RED")
尝试使用fg(或foreground)和bg(或background)选项。如果a是菜单,请使用: a.entryconfig(optionindex,bg="color_name")作为背景,以及 a.entryconfig(optionindex,bg="color_name")。在
fg
foreground
bg
background
a
a.entryconfig(
optionindex
,
bg="
color_name
"
)
bg=
所以你只需要使用
OptionMenu.entryconfig(*index of item*, background = *color)
尝试使用
fg
(或foreground
)和bg
(或background
)选项。如果a
是菜单,请使用:a.entryconfig(
optionindex
,
bg="
color_name
"
)
作为背景,以及a.entryconfig(
optionindex
,
bg=
"
color_name
"
)
。在相关问题 更多 >
编程相关推荐