选择组合框时删除蓝色突出显示 python
Remove blue highlighting when selecting combobox python
我做了一个组合框,我想在我选择一个项目时删除蓝色突出显示。
我是 Python 的初学者,我希望使用 tkinter 创建一个 Python 界面。我浏览了所有帖子和网站,但无法解决我的问题。
我可以在 SelectionStart、SelectionLength、selection_clear、selectionbrush 周围看到几个站点,但没有成功....
# -*- coding: UTF-8 -*-
from tkinter import *
import tkinter.ttk as ttk
#rootframe
root = Tk()
root.geometry("900x570")
root.configure(background='#ffffff')
###frame
Frame1 = Frame(root,width=256, height=370, background="#cbf1f5")
Frame1.place(x=20, y=20)
#title frame
label_title_ech = Label(Frame1, text="""Échelle d'analyse""",font='Helvetica 12 bold', width='22', background="#71c9ce")
label_title_ech.place(x=15, y=20)
#choice of analysis scale
combobox1 = ttk.Combobox(Frame1, values=["Mailles de 5km", "Mailles de 2.5km", "Mailles de 1km", "Mailles de 500m"])
combobox1.place(x=55,y=70)
combobox1.current(0)
root.option_add('*TCombobox*Listbox.selectBackground', '#71c9ce')
root.option_add('*TCombobox*Listbox.selectForeground', 'white')
root.mainloop()
所以我想去掉选择项目时的蓝色高亮。
感谢您的帮助。
文森特
不确定为什么要这样做,但您可以将事件绑定到 <<ComboboxSelected>>
并将焦点移到另一个小部件以避免蓝色突出显示:
combobox1.bind("<<ComboboxSelected>>",lambda e: Frame1.focus())
我做了一个组合框,我想在我选择一个项目时删除蓝色突出显示。
我是 Python 的初学者,我希望使用 tkinter 创建一个 Python 界面。我浏览了所有帖子和网站,但无法解决我的问题。 我可以在 SelectionStart、SelectionLength、selection_clear、selectionbrush 周围看到几个站点,但没有成功....
# -*- coding: UTF-8 -*-
from tkinter import *
import tkinter.ttk as ttk
#rootframe
root = Tk()
root.geometry("900x570")
root.configure(background='#ffffff')
###frame
Frame1 = Frame(root,width=256, height=370, background="#cbf1f5")
Frame1.place(x=20, y=20)
#title frame
label_title_ech = Label(Frame1, text="""Échelle d'analyse""",font='Helvetica 12 bold', width='22', background="#71c9ce")
label_title_ech.place(x=15, y=20)
#choice of analysis scale
combobox1 = ttk.Combobox(Frame1, values=["Mailles de 5km", "Mailles de 2.5km", "Mailles de 1km", "Mailles de 500m"])
combobox1.place(x=55,y=70)
combobox1.current(0)
root.option_add('*TCombobox*Listbox.selectBackground', '#71c9ce')
root.option_add('*TCombobox*Listbox.selectForeground', 'white')
root.mainloop()
所以我想去掉选择项目时的蓝色高亮。
感谢您的帮助。 文森特
不确定为什么要这样做,但您可以将事件绑定到 <<ComboboxSelected>>
并将焦点移到另一个小部件以避免蓝色突出显示:
combobox1.bind("<<ComboboxSelected>>",lambda e: Frame1.focus())