根据查询结果更改tkinter中Treeview小部件的背景色

根据查询结果更改tkinter中Treeview小部件的背景色,tkinter,treeview,python-3.7,background-color,Tkinter,Treeview,Python 3.7,Background Color,我想根据查询结果更改treeview的背景色,因此如果查询条件(condiquery参数)等于“”,则背景色必须为“白色”,如果条件不同,则颜色必须为“浅蓝色” 此代码工作正常,但只是第一次(颜色刚刚更改两次,从白色更改为浅蓝色,其余时间使用浅蓝色重新生成) 有人愿意帮助我吗 #Funcion Query Traer Pacientes def get_pacientes(self, condiquery): #limpio el color de fondo

我想根据查询结果更改treeview的背景色,因此如果查询条件(condiquery参数)等于“”,则背景色必须为“白色”,如果条件不同,则颜色必须为“浅蓝色”

此代码工作正常,但只是第一次(颜色刚刚更改两次,从白色更改为浅蓝色,其余时间使用浅蓝色重新生成)

有人愿意帮助我吗

#Funcion Query Traer Pacientes
    def get_pacientes(self, condiquery):
        #limpio el color de fondo
        self.pac_win.style.configure("mystyle.Treeview", highlightthickness=0, bd=0, background='white', font=('Lucida Console', 9)) # Formato  del Cuerpo
        global acu_name
        self.acu_name=self.acu_name+1
        print(self.acu_name)
        #Limpio la tabla de pacietnes
        records = self.pac_win.pactree.get_children()
        for element in records:
            self.pac_win.pactree.delete(element)
        #Consulto los pacientes
        query = 'SELECT * from Padron where Status = 1 ORDER BY Paciente ASC'
        if condiquery !="":
            query = condiquery
            self.pac_win.style.configure("mystyle.Treeview", highlightthickness=0, bd=0, background='light blue', font=('Lucida Console', 9)) # Formato  del Cuerpo
        dbregpac = self.run_queries(query)
        #lleno la tabla 
        for row in dbregpac:
            self.pac_win.pactree.insert("",0,text = row[0], values = row[1])