Python Forum
[GI] Error when I close the interface Glade/GTK3/
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[GI] Error when I close the interface Glade/GTK3/
#1
Hello everyone

I have a probleme with my interface glade. I can open my interface, no problem with that, It's work in the way I want but when I close it all the main programm stop and I have two messages in the consol

Error:
(BouclePrincipal.py:50516): Gtk-CRITICAL **: 09:01:00.615: gtk_widget_get_accessible: assertion 'GTK_IS_WIDGET (widget)' failed> (BouclePrincipal.py:50516): Atk-CRITICAL **: 09:01:00.615: atk_object_remove_relationship: assertion 'ATK_IS_OBJECT (target)' failed
I don't understand what/where is the problem. I tried to add return true like the following answer but it's dosn't work. Furthermore I don't know what I need to post for this problem (the glade interface ? the init python )


Thank you for your futur answer
Reply
#2
here the python code

# on importe les librairies dont nous avons besoins
import gi
import sqlite3
import Alerte
import datetime
import AjouterMedicament

gi.require_version("Gtk", "3.0")
from gi.repository import Gtk

Idutilisateur = 0


# on creer la classe pour l'interface
class AffichageEcritureIP:
    # ligne de code qui se lance lorsque de l'initialisation
    def __init__(self):
        # on creer la fenetre à partir de l'interface glade
        self.builder = Gtk.Builder()
        self.builder.add_from_file('EcritureIP.glade')
        self.window = self.builder.get_object('Main_Windows_IP')
        # on creer des objetrs pour chaqu'une des interractions
        self.builder.connect_signals(self)
        # on creer les variables
        self.DateIP = self.builder.get_object("DateRealisation")
        self.Service = self.builder.get_object("Services")
        self.NomPatient = self.builder.get_object("NomPatient")
        self.PrenomPatient = self.builder.get_object("PrenomPatient")
        self.Age = self.builder.get_object("Age")
        self.UniteAge = self.builder.get_object("UniteAge")
        self.Sexe = self.builder.get_object("Sexe")
        self.Probleme = self.builder.get_object("Probleme")
        self.Intervention = self.builder.get_object("Intervention")
        self.ATC1 = self.builder.get_object("ClasseATC1")
        self.ATC2 = self.builder.get_object("ClasseATC2")
        self.ProblemeDescription = self.builder.get_object("ProblemeDescription")
        self.Devenir = self.builder.get_object("DevenirIntervention")
        self.RetourMedecin = self.builder.get_object("RetourMedecin")
        self.Medoc1 = self.builder.get_object("Médicament1")
        self.Medoc2 = self.builder.get_object("Médicament2")
        self.Prescripteur = self.builder.get_object("Prescripteur")
        self.Contact = self.builder.get_object("Contact")
        self.CotationClinique = self.builder.get_object("CotationClinique")
        self.CotationEconomique = self.builder.get_object("CotationEconomique")
        self.CotationOrga = self.builder.get_object("CotationOrga")
        self.Conciliation = self.builder.get_object("Conciliation")
        self.Poids = self.builder.get_object("Poids")
        self.RetourMedecin = self.builder.get_object("RetourMedecin")
        self.DateMedecin = self.builder.get_object("DateMedecin")
        self.NumIP = self.builder.get_object("NumIP")


        # on affecte la date du jour à l'entrée
        dateBrut = datetime.datetime.now()
        DateJour = FormatDate(dateBrut.day, dateBrut.month, dateBrut.year)
        self.DateIP.set_text(DateJour)

        #on va creer les listes pour remplir les listes déroulantes
        conn = sqlite3.connect('déclaration.db')
        cursor = conn.cursor()
        cursor.execute("""SELECT NomService FROM Service """)
        self.ListeService = cursor.fetchall()
        cursor.execute("""SELECT Description FROM Probleme """)
        ListeProbleme = cursor.fetchall()
        cursor.execute("""SELECT Description FROM Resolution """)
        ListeResolution = cursor.fetchall()
        cursor.execute("""SELECT Description FROM ATC """)
        ListeATC = cursor.fetchall()
        cursor.execute("""SELECT Description FROM Devenir """)
        ListeDevenir = cursor.fetchall()
        cursor.execute("""SELECT Description FROM Prescripteur """)
        ListePrescripteur = cursor.fetchall()
        cursor.execute("""SELECT Description FROM Transmission """)
        ListeTransmission = cursor.fetchall()
        cursor.execute("""SELECT Description FROM CotationClinique """)
        ListeCotationClinique = cursor.fetchall()
        cursor.execute("""SELECT Description FROM CotationEconomique """)
        ListeCotationEconomique = cursor.fetchall()
        cursor.execute("""SELECT Description FROM CotationOrganisationnel """)
        ListeCotationOrga = cursor.fetchall()
        cursor.execute("""SELECT Libelle FROM Medoc ORDER BY Libelle ASC""")
        self.ListeMedoc = cursor.fetchall()
        cursor.execute("""SELECT Libelle FROM Sexe """)
        ListeSexe = cursor.fetchall()
        cursor.execute("""SELECT Libelle FROM UniteAge """)
        ListeUniteAge = cursor.fetchall()
        conn.close()


        # on va rajouter les services dans la liste
        for service in self.ListeService:
            self.Service.append_text(service[0])

        # on va rajouter les problemes dans la liste
        for probleme in ListeProbleme:
            self.Probleme.append_text(probleme[0])

        # on va rajouter les resolutions dans la liste
        for resolution in ListeResolution:
            self.Intervention.append_text(resolution[0])

        # on va rajouter les classe ATC dans la liste
        for resolution in ListeATC:
            self.ATC1.append_text(resolution[0])
            self.ATC2.append_text(resolution[0])

        # on va rajouter les  Devenir dans la liste
        for resolution in ListeDevenir:
            self.Devenir.append_text(resolution[0])

        # on va rajouter les prescripteur dans la liste
        for resolution in ListePrescripteur:
            self.Prescripteur.append_text(resolution[0])

        # on va rajouter le contact dans la liste
        for resolution in ListeTransmission:
            self.Contact.append_text(resolution[0])

        # on va rajouter les cotation clinique dans la liste
        for resolution in ListeCotationClinique:
            self.CotationClinique.append_text(resolution[0])

        # on va rajouter les cotation economique dans la liste
        for resolution in ListeCotationEconomique:
            self.CotationEconomique.append_text(resolution[0])

        # on va rajouter les cotation Orga dans la liste
        for resolution in ListeCotationOrga:
            self.CotationOrga.append_text(resolution[0])

        # on va rajouter les cotation Orga dans la liste
        for resolution in self.ListeMedoc:
            self.Medoc1.append_text(resolution[0])
            self.Medoc2.append_text(resolution[0])

        # on va rajouter les sexe dans la liste
        for resolution in ListeSexe:
            self.Sexe.append_text(resolution[0])

        # on va rajouter les unite d'age dans la liste
        for resolution in ListeUniteAge:
            self.UniteAge.append_text(resolution[0])

        #on va creer l'autocomplete pour les medicament
        self.liststoreMedoc = Gtk.ListStore(str)
        for s in list(sum(self.ListeMedoc,())):
            self.liststoreMedoc.append([s])
        self.autocompletemedoc = Gtk.EntryCompletion()
        self.autocompletemedoc.set_model(self.liststoreMedoc)
        self.autocompletemedoc.set_text_column(0)
        self.builder.get_object("EntreMedoc1").set_completion(self.autocompletemedoc)
        self.builder.get_object("EntreMedoc2").set_completion(self.autocompletemedoc)



    def ClicConciliation(self, widget):
        if self.Conciliation.get_label() == "Non":
            self.Conciliation.set_label("Oui")
        else:
            self.Conciliation.set_label("Non")

    def ValidationIP(self, widget):
        global Idutilisateur
        # on commence par verifier que les donne importante sont saisie
        continuer = 0
        if len(self.DateIP.get_text()) == 0:
            Alerte.appelAffichageAlerte("Il faut saisir la date")
            continuer = 1
        if len(self.Service.get_active_text()) == 0:
            Alerte.appelAffichageAlerte("Il faut saisir le service")
            continuer = 1
        if len(self.Age.get_text()) == 0:
            Alerte.appelAffichageAlerte("Il faut saisir l'age du patient")
            continuer = 1
        if self.UniteAge.get_active_text() is None:
            Alerte.appelAffichageAlerte("Il faut saisir l'unite de l'age du patient")
            continuer = 1
        if self.Sexe.get_active_text() is None:
            Alerte.appelAffichageAlerte("Il faut saisir le sexe du patient")
            continuer = 1
        if self.Probleme.get_active_text() is None:
            Alerte.appelAffichageAlerte("Il faut saisir le probleme")
            continuer = 1
        if self.Intervention.get_active_text() is None:
            Alerte.appelAffichageAlerte("Il faut saisir l'intervention")
            continuer = 1
        if self.Prescripteur.get_active_text() is None:
            Alerte.appelAffichageAlerte("Il faut saisir le prescripteur")
            continuer = 1
        if len(self.Medoc1.get_active_text()) == 0:
            Alerte.appelAffichageAlerte("Il faut saisir le médicament")
            continuer = 1
        if self.Devenir.get_active_text() is None:
            Alerte.appelAffichageAlerte("Il faut saisir le devenir de l'IP")
            continuer = 1
        # on creer un tableau avec les IP qui necessitent de saisir un autre médicaments
        IPavecdeuxMedoc = [15, 19, 20, 21, 22, 23, 24, 25, 34]
        # on rajoute 1 à l'ID car le premier de la liste à l'ID 0
        IDProbleme = (self.Probleme.get_active() + 1)
        if IDProbleme in IPavecdeuxMedoc and len(self.Medoc2.get_active_text()) == 0:
            Alerte.appelAffichageAlerte("Il faut saisir le second médicament pour cette intervention")
            continuer = 1

        if continuer == 1:
            pass
        else:
            # on va donc ajouter l'IP dans la base
            global Idutilisateur
            # on transformer la conciliation en 1 ou 0
            if self.Conciliation.get_label() == "Non":
                Conciliation = 0
            else:
                Conciliation = 1

            #on va verifier que le/les medoc(s) saisi existe bien dans la base de donnée
            # on verifie si le service fait partie de la liste
            # on va transformer la liste de tuple en list pur
            if self.Medoc1.get_active_text() in list(sum(self.ListeMedoc,())):
               pass
            else:
                AjouterMedicament.appelAffichageAjoutMedicament(self.Medoc1.get_active_text(), self.ATC1.get_active(),1)

            if self.Medoc2.get_active_text()=="" or self.Medoc2.get_active_text() in list(sum(self.ListeMedoc,())):
               pass
            else:
                AjouterMedicament.appelAffichageAjoutMedicament(self.Medoc2.get_active_text(), self.ATC2.get_active(),1)

            # on va chercher le code UCD et l'id du médicament
            conn = sqlite3.connect('déclaration.db')
            cursor = conn.cursor()
            cursor.execute("SELECT id,CodeUCD FROM Medoc WHERE Libelle = ?", (self.Medoc1.get_active_text(),))
            Medicament1 = cursor.fetchone()

            if self.Medoc2.get_active_text() == "":
                Medicament2 =[0,0]
            else:
                cursor.execute("SELECT id,CodeUCD FROM Medoc WHERE Libelle = ?", (self.Medoc2.get_active_text(),))
                Medicament2 = cursor.fetchone()
            conn.close()

            # on va creer des variable pour les texte
            # pour le TextViewer le texte est lié à une Buffer de Texte
            # pour afficher le texte il est necessaire d'avoir le début et la fin du texte
            # on creer donc le début et la fin et on l'inclut dans
            iterdebut, iterfin = self.ProblemeDescription.get_bounds()
            DescriptionProbleme = str(self.ProblemeDescription.get_text(iterdebut, iterfin, include_hidden_chars=True))
            iterdebut2, iterfin2 = self.RetourMedecin.get_bounds()
            RetourMedecin = str(self.RetourMedecin.get_text(iterdebut2, iterfin2, include_hidden_chars=True))

            # on creer une liste de tuplue pour fussioner avec la liste pour inserer les donnes
            IP = [(str(self.DateIP.get_text()),
                   Idutilisateur,
                   str(self.NomPatient.get_text()),
                   str(self.PrenomPatient.get_text()),
                   str(self.Age.get_text()),
                   self.UniteAge.get_active()+1,
                   self.Sexe.get_active()+1,
                   str(self.Poids.get_text()),
                   self.Probleme.get_active() + 1,
                   Medicament1[0],
                   Medicament1[1],
                   self.ATC1.get_active()+1,
                   Medicament2[0],
                   Medicament2[1],
                   self.ATC2.get_active()+1,
                   self.Service.get_active() + 1,
                   DescriptionProbleme,
                   self.Intervention.get_active() + 1,
                   self.Prescripteur.get_active() + 1,
                   self.Contact.get_active() + 1,
                   self.DateMedecin.get_text(),
                   self.Devenir.get_active() + 1,
                   self.CotationClinique.get_active() + 1,
                   self.CotationEconomique.get_active() + 1,
                   self.CotationOrga.get_active() + 1,
                   Conciliation,
                   RetourMedecin)]
            # pour reussir à faire l'insertion des données avec le Update , on creer une liste avec les noms de colonne
            ColonneSQL = [
                "DateSaisie",
                "Utilisateur",
                "NomPatient",
                "PrenomPatient",
                "AgePatient",
                "UniteAgePatient",
                "SexePatient",
                "Poids",
                "Probleme",
                "Medicament1",
                "CodeUCD1",
                "ATC1",
                "Medicament2",
                "CodeUCD2",
                "ATC2",
                "Service",
                "DescriptionProbleme",
                "Intervention",
                "Prescripteur",
                "Transmission",
                "DateContactMedecin",
                "DevenirIntervention",
                "CotationClinique",
                "CotationEconomique",
                "CotationOrganisationnel",
                "Conciliation",
                "JustificatifIntervention"
            ]

            #on creer une liste pour faire un for sur les nombres
            nombre = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]

            # on se connecte à la base
            conn = sqlite3.connect('déclaration.db')
            cursor = conn.cursor()

            # on va utiliser l'interface pour saisir et modifier les IP
            # on va donc verifier si le numeroIP est saisie, dans la textbox, si ce n'est pas le cas on ajoute et on
            # affiche le numero IP
            # si c'est n'ai pas le cas on verifie que l'IP existe est on la met à jour
            if len(self.NumIP.get_text()) == 0:
                for i in IP:
                    cursor.execute(
                        "INSERT INTO Intervention(DateSaisie,Utilisateur,NomPatient,PrenomPatient,AgePatient,"
                        "UniteAgePatient,SexePatient,Poids,Probleme,Medicament1,CodeUCD1,ATC1,Medicament2,CodeUCD2,"
                        "ATC2,Service,DescriptionProbleme,Intervention,Prescripteur,Transmission,DateContactMedecin,"
                        "DevenirIntervention,CotationClinique,CotationEconomique,CotationOrganisationnel,Conciliation,"
                        "JustificatifIntervention) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", i)
                id = cursor.lastrowid
                message = "Féliciation vous avez sauvegarder votre IP sous le numero " + str(id)
                self.NumIP.set_text(str(id))
                Alerte.appelAffichageAlerte(message)
                conn.commit()
                conn.close()
            else:
                # on va tester voir si le numero de l'IP existe
                cursor.execute("SELECT count(*) FROM Intervention WHERE id= ?", (int(self.NumIP.get_text()),))
                IpExiste = cursor.fetchone()
                if IpExiste[0] == 0:
                    Alerte.appelAffichageAlerte("L'IP n'existe pas")
                    conn.close()
                else:
                    # on creer une boucle pour mettre à jour l'IP
                    for i in nombre:
                        sql = "UPDATE Intervention SET " + ColonneSQL[i] + "=? WHERE id=" + str(self.NumIP.get_text())
                        cursor.execute(sql, (IP[0][i],))
                        conn.commit()
                    conn.close()



    def Lecture(self,widget):
        """
            Cette fonction permet de lire la BDD et si , l'IP existe, mettre l'ensemble des données dans l'interface.
        """
        if self.NumIP.get_text() is None or self.NumIP.get_text()=="":
            self.effacerinterface(self)
        else:
            conn = sqlite3.connect('déclaration.db')
            cursor = conn.cursor()
            cursor.execute("SELECT count(*) FROM Intervention WHERE id= ?", (int(self.NumIP.get_text()),))
            IpExiste = cursor.fetchone()
            if IpExiste[0] == 1:
                cursor.execute("SELECT * FROM Intervention WHERE id= ?",(int(self.NumIP.get_text()),))
                ip_complete = cursor.fetchone()
                cursor.execute("SELECT Libelle FROM Medoc WHERE id= ?",(int(ip_complete[10]),))
                NomMedicament1  = cursor.fetchone()
                if int(ip_complete[13])==0:
                    NomMedicament2=[""]
                else:
                    cursor.execute("SELECT Libelle FROM Medoc WHERE id= ?",(int(ip_complete[13]),))
                    NomMedicament2  = cursor.fetchone()
                conn.close()
                self.DateIP.set_text(ip_complete[1])
                self.Service.set_active(int(ip_complete[16])-1)
                self.NomPatient.set_text(ip_complete[3])
                self.PrenomPatient.set_text(ip_complete[4])
                self.Age.set_text(str(ip_complete[5]))
                self.UniteAge.set_active(ip_complete[6]-1)
                self.Sexe.set_active(ip_complete[7] - 1)
                self.Poids.set_text(ip_complete[8])
                self.Probleme.set_active(ip_complete[9]-1)
                self.builder.get_object("EntreMedoc1").set_text(NomMedicament1[0])
                self.ATC1.set_active(ip_complete[12]-1)
                self.builder.get_object("EntreMedoc2").set_text(NomMedicament2[0])
                self.ATC2.set_active(ip_complete[15]-1)
                self.ProblemeDescription.set_text(ip_complete[17])
                self.Intervention.set_active(ip_complete[18]-1)
                self.Prescripteur.set_active(ip_complete[19]-1)
                self.Contact.set_active(ip_complete[20]-1)
                self.DateMedecin.set_text(ip_complete[21])
                self.Devenir.set_active(ip_complete[22]-1)
                self.CotationClinique.set_active(ip_complete[23]-1)
                self.CotationEconomique.set_active(ip_complete[24]-1)
                self.CotationOrga.set_active(ip_complete[25]-1)
                if ip_complete[26]==self.Conciliation.get_label():
                    pass
                else:
                    self.Conciliation.activate()
                self.RetourMedecin.set_text(ip_complete[27])
            else:
                self.effacerinterface(self)

    def ChangementMedicament1(self,widget):
        """
        Permet de changer le code ATC automatiquement quand on saisie un médicament dans la bare 1
        """
        if self.builder.get_object("EntreMedoc1").get_text()=="":
            pass
        else:
            conn = sqlite3.connect('déclaration.db')
            cursor = conn.cursor()
            SQL = "SELECT ClasseATC FROM Medoc WHERE Libelle= ?"
            Val = self.builder.get_object("EntreMedoc1").get_text()
            cursor.execute(SQL ,(Val,) )
            ClassATC = cursor.fetchone()
            if cursor.rowcount <0:
                self.builder.get_object("EntreClasseATC1").set_text("")
            else:
                self.ATC1.set_active(ClassATC[0]  - 1)

    def ChangementMedicament2(self,widget):
        """
        Permet de changer le code ATC automatiquement quand on saisie un médicament dans la bare 2
        """

        if self.builder.get_object("EntreMedoc2").get_text()=="":
            pass
        else:
            conn = sqlite3.connect('déclaration.db')
            cursor = conn.cursor()
            SQL = "SELECT ClasseATC FROM Medoc WHERE Libelle= ?"
            Val = self.builder.get_object("EntreMedoc2").get_text()
            cursor.execute(SQL ,(Val,) )
            ClassATC = cursor.fetchone()
            if cursor.rowcount<0:
                self.builder.get_object("EntreClasseATC2").set_text("")
            else:
                self.ATC2.set_active(ClassATC[0]  - 1)

    def effacerinterface(self,widget):
        dateBrut = datetime.datetime.now()
        DateJour = FormatDate(dateBrut.day, dateBrut.month, dateBrut.year)
        self.DateIP.set_text(DateJour)
        self.builder.get_object("EntreService").set_text("")
        self.NomPatient.set_text("")
        self.PrenomPatient.set_text("")
        self.Age.set_text("")
        self.builder.get_object("EntreUA").set_text("")
        self.builder.get_object("EntreSexe").set_text("")
        self.Poids.set_text("")
        self.builder.get_object("EntreProbleme").set_text("")
        self.builder.get_object("EntreMedoc1").set_text("")
        self.builder.get_object("EntreClasseATC1").set_text("")
        self.builder.get_object("EntreMedoc2").set_text("")
        self.builder.get_object("EntreClasseATC2").set_text("")
        self.ProblemeDescription.set_text("")
        self.builder.get_object("EntreIntervention").set_text("")
        self.builder.get_object("EntreMedecin").set_text("")
        self.builder.get_object("EntreContact").set_text("")
        self.DateMedecin.set_text("")
        self.builder.get_object("EntreDevenir").set_text("")
        self.builder.get_object("EntreClinique").set_text("")
        self.builder.get_object("EntreEconomique").set_text("")
        self.builder.get_object("EntreOrga").set_text("")
        if self.Conciliation.get_label() == "Oui":
            self.Conciliation.activate()

    def FermetureIP(self,widget):
        Gtk.main_quit()
        self.window.destroy()



def FormatDate(jour, mois, annee):
    jour = str(jour)
    mois = str(mois)
    annee = str(annee)
    if len(jour) < 2: jour = "0" + jour
    if len(mois) < 2: mois = "0" + mois
    return str(jour) + "/" + str(mois) + "/" + str(annee)


def appelAffichageAjoutIP(IDUtilisateurEnvoye):
    global Idutilisateur
    Idutilisateur = IDUtilisateurEnvoye
    AffichageEcritureIP()
    Gtk.main()
and here the glade code
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.36.0 -->
<interface>
  <requires lib="gtk+" version="3.20"/>
  <object class="GtkTextBuffer" id="ProblemeDescription"/>
  <object class="GtkTextBuffer" id="RetourMedecin"/>
  <object class="GtkWindow" id="Main_Windows_IP">
    <property name="visible">True</property>
    <property name="can_focus">False</property>
    <property name="default_width">450</property>
    <property name="default_height">350</property>
    <signal name="delete-event" handler="FermetureIP" swapped="no"/>
    <signal name="destroy" handler="FermetureIP" swapped="no"/>
    <child>
      <object class="GtkBox">
        <property name="visible">True</property>
        <property name="can_focus">False</property>
        <property name="orientation">vertical</property>
        <child>
          <object class="GtkLabel">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="label" translatable="yes">Saisir une nouvelle Intervention</property>
            <attributes>
              <attribute name="weight" value="bold"/>
              <attribute name="background" value="#eeeeeeeeecec"/>
            </attributes>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">True</property>
            <property name="position">0</property>
          </packing>
        </child>
        <child>
          <object class="GtkGrid">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="margin_top">5</property>
            <property name="margin_bottom">5</property>
            <property name="row_spacing">2</property>
            <property name="column_spacing">8</property>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Nom du patient</property>
              </object>
              <packing>
                <property name="left_attach">0</property>
                <property name="top_attach">3</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Prénom du patient</property>
              </object>
              <packing>
                <property name="left_attach">0</property>
                <property name="top_attach">4</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Poids</property>
              </object>
              <packing>
                <property name="left_attach">0</property>
                <property name="top_attach">5</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Service</property>
              </object>
              <packing>
                <property name="left_attach">0</property>
                <property name="top_attach">2</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Numéro de l'IP</property>
              </object>
              <packing>
                <property name="left_attach">0</property>
                <property name="top_attach">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Date de réalisation</property>
              </object>
              <packing>
                <property name="left_attach">0</property>
                <property name="top_attach">0</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Age</property>
              </object>
              <packing>
                <property name="left_attach">0</property>
                <property name="top_attach">6</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Sexe</property>
              </object>
              <packing>
                <property name="left_attach">0</property>
                <property name="top_attach">8</property>
              </packing>
            </child>
            <child>
              <object class="GtkEntry" id="DateRealisation">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="top_attach">0</property>
              </packing>
            </child>
            <child>
              <object class="GtkEntry" id="NumIP">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <signal name="changed" handler="Lecture" swapped="no"/>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="top_attach">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkEntry" id="NomPatient">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="max_length">3</property>
                <property name="max_width_chars">3</property>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="top_attach">3</property>
              </packing>
            </child>
            <child>
              <object class="GtkEntry" id="PrenomPatient">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="max_length">2</property>
                <property name="max_width_chars">2</property>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="top_attach">4</property>
              </packing>
            </child>
            <child>
              <object class="GtkEntry" id="Poids">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="top_attach">5</property>
              </packing>
            </child>
            <child>
              <object class="GtkEntry" id="Age">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="top_attach">6</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Probleme</property>
              </object>
              <packing>
                <property name="left_attach">0</property>
                <property name="top_attach">9</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Intervention</property>
              </object>
              <packing>
                <property name="left_attach">0</property>
                <property name="top_attach">10</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Description du probleme</property>
              </object>
              <packing>
                <property name="left_attach">2</property>
                <property name="top_attach">0</property>
                <property name="height">2</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel" id="LabelMedoc1">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Médicament 1</property>
              </object>
              <packing>
                <property name="left_attach">2</property>
                <property name="top_attach">2</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Classe médicament 1</property>
              </object>
              <packing>
                <property name="left_attach">2</property>
                <property name="top_attach">3</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Médicament 2</property>
              </object>
              <packing>
                <property name="left_attach">2</property>
                <property name="top_attach">4</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Classe médicament 2</property>
              </object>
              <packing>
                <property name="left_attach">2</property>
                <property name="top_attach">5</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Devenir de l'intervention</property>
              </object>
              <packing>
                <property name="left_attach">2</property>
                <property name="top_attach">11</property>
              </packing>
            </child>
            <child>
              <object class="GtkEntry" id="DateMedecin">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
              </object>
              <packing>
                <property name="left_attach">3</property>
                <property name="top_attach">8</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Date contact médecin</property>
              </object>
              <packing>
                <property name="left_attach">2</property>
                <property name="top_attach">8</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Retour du médecin</property>
              </object>
              <packing>
                <property name="left_attach">2</property>
                <property name="top_attach">9</property>
                <property name="height">2</property>
              </packing>
            </child>
            <child>
              <object class="GtkTextView" id="RetourMedeci">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="wrap_mode">char</property>
                <property name="justification">fill</property>
                <property name="buffer">RetourMedecin</property>
              </object>
              <packing>
                <property name="left_attach">3</property>
                <property name="top_attach">9</property>
                <property name="height">2</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Unite de l'âge</property>
              </object>
              <packing>
                <property name="left_attach">0</property>
                <property name="top_attach">7</property>
              </packing>
            </child>
            <child>
              <object class="GtkComboBoxText" id="Médicament1">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="is_focus">True</property>
                <property name="has_entry">True</property>
                <signal name="changed" handler="ChangementMedicament1" swapped="no"/>
                <child internal-child="entry">
                  <object class="GtkEntry" id="EntreMedoc1">
                    <property name="visible">True</property>
                    <property name="can_focus">True</property>
                  </object>
                </child>
              </object>
              <packing>
                <property name="left_attach">3</property>
                <property name="top_attach">2</property>
              </packing>
            </child>
            <child>
              <object class="GtkComboBoxText" id="ClasseATC1">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="has_entry">True</property>
                <child internal-child="entry">
                  <object class="GtkEntry" id="EntreClasseATC1">
                    <property name="visible">True</property>
                    <property name="can_focus">True</property>
                    <property name="editable">False</property>
                  </object>
                </child>
              </object>
              <packing>
                <property name="left_attach">3</property>
                <property name="top_attach">3</property>
              </packing>
            </child>
            <child>
              <object class="GtkTextView">
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="wrap_mode">char</property>
                <property name="justification">fill</property>
                <property name="buffer">ProblemeDescription</property>
              </object>
              <packing>
                <property name="left_attach">3</property>
                <property name="top_attach">0</property>
                <property name="height">2</property>
              </packing>
            </child>
            <child>
              <object class="GtkComboBoxText" id="Services">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="has_entry">True</property>
                <child internal-child="entry">
                  <object class="GtkEntry" id="EntreService">
                    <property name="visible">True</property>
                    <property name="can_focus">True</property>
                  </object>
                </child>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="top_attach">2</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Prescripteur</property>
              </object>
              <packing>
                <property name="left_attach">0</property>
                <property name="top_attach">11</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Contact médecin</property>
              </object>
              <packing>
                <property name="left_attach">2</property>
                <property name="top_attach">6</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Intervention pendant la conciliation</property>
              </object>
              <packing>
                <property name="left_attach">2</property>
                <property name="top_attach">7</property>
              </packing>
            </child>
            <child>
              <object class="GtkToggleButton" id="Conciliation">
                <property name="label" translatable="yes">Non</property>
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="receives_default">True</property>
                <signal name="toggled" handler="ClicConciliation" swapped="no"/>
              </object>
              <packing>
                <property name="left_attach">3</property>
                <property name="top_attach">7</property>
              </packing>
            </child>
            <child>
              <object class="GtkComboBoxText" id="UniteAge">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="has_entry">True</property>
                <child internal-child="entry">
                  <object class="GtkEntry" id="EntreUA">
                    <property name="can_focus">False</property>
                  </object>
                </child>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="top_attach">7</property>
              </packing>
            </child>
            <child>
              <object class="GtkComboBoxText" id="Sexe">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="has_entry">True</property>
                <child internal-child="entry">
                  <object class="GtkEntry" id="EntreSexe">
                    <property name="can_focus">False</property>
                  </object>
                </child>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="top_attach">8</property>
              </packing>
            </child>
            <child>
              <object class="GtkComboBoxText" id="Médicament2">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="has_entry">True</property>
                <signal name="changed" handler="ChangementMedicament2" swapped="no"/>
                <child internal-child="entry">
                  <object class="GtkEntry" id="EntreMedoc2">
                    <property name="visible">True</property>
                    <property name="can_focus">True</property>
                  </object>
                </child>
              </object>
              <packing>
                <property name="left_attach">3</property>
                <property name="top_attach">4</property>
              </packing>
            </child>
            <child>
              <object class="GtkComboBoxText" id="ClasseATC2">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="has_entry">True</property>
                <child internal-child="entry">
                  <object class="GtkEntry" id="EntreClasseATC2">
                    <property name="can_focus">False</property>
                    <property name="editable">False</property>
                  </object>
                </child>
              </object>
              <packing>
                <property name="left_attach">3</property>
                <property name="top_attach">5</property>
              </packing>
            </child>
            <child>
              <object class="GtkComboBoxText" id="Contact">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="has_entry">True</property>
                <child internal-child="entry">
                  <object class="GtkEntry" id="EntreContact">
                    <property name="can_focus">False</property>
                    <property name="editable">False</property>
                  </object>
                </child>
              </object>
              <packing>
                <property name="left_attach">3</property>
                <property name="top_attach">6</property>
              </packing>
            </child>
            <child>
              <object class="GtkComboBoxText" id="DevenirIntervention">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="has_entry">True</property>
                <child internal-child="entry">
                  <object class="GtkEntry" id="EntreDevenir">
                    <property name="visible">True</property>
                    <property name="can_focus">False</property>
                    <property name="editable">False</property>
                  </object>
                </child>
              </object>
              <packing>
                <property name="left_attach">3</property>
                <property name="top_attach">11</property>
              </packing>
            </child>
            <child>
              <object class="GtkComboBoxText" id="Probleme">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="has_entry">True</property>
                <child internal-child="entry">
                  <object class="GtkEntry" id="EntreProbleme">
                    <property name="can_focus">False</property>
                    <property name="editable">False</property>
                  </object>
                </child>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="top_attach">9</property>
              </packing>
            </child>
            <child>
              <object class="GtkComboBoxText" id="Intervention">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="has_entry">True</property>
                <child internal-child="entry">
                  <object class="GtkEntry" id="EntreIntervention">
                    <property name="can_focus">False</property>
                    <property name="editable">False</property>
                  </object>
                </child>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="top_attach">10</property>
              </packing>
            </child>
            <child>
              <object class="GtkComboBoxText" id="Prescripteur">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="has_entry">True</property>
                <child internal-child="entry">
                  <object class="GtkEntry" id="EntreMedecin">
                    <property name="can_focus">False</property>
                    <property name="editable">False</property>
                  </object>
                </child>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="top_attach">11</property>
              </packing>
            </child>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">True</property>
            <property name="position">1</property>
          </packing>
        </child>
        <child>
          <object class="GtkGrid">
            <property name="visible">True</property>
            <property name="can_focus">False</property>
            <property name="column_homogeneous">True</property>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Cotation</property>
                <attributes>
                  <attribute name="weight" value="bold"/>
                </attributes>
              </object>
              <packing>
                <property name="left_attach">0</property>
                <property name="top_attach">0</property>
                <property name="width">3</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Clinique</property>
              </object>
              <packing>
                <property name="left_attach">0</property>
                <property name="top_attach">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Economique</property>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="top_attach">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="label" translatable="yes">Organisationnel</property>
              </object>
              <packing>
                <property name="left_attach">2</property>
                <property name="top_attach">1</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
              </object>
              <packing>
                <property name="left_attach">0</property>
                <property name="top_attach">3</property>
              </packing>
            </child>
            <child>
              <object class="GtkLabel">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="top_attach">3</property>
              </packing>
            </child>
            <child>
              <object class="GtkButton">
                <property name="label" translatable="yes">Valider</property>
                <property name="visible">True</property>
                <property name="can_focus">True</property>
                <property name="receives_default">True</property>
                <signal name="clicked" handler="ValidationIP" swapped="no"/>
              </object>
              <packing>
                <property name="left_attach">2</property>
                <property name="top_attach">3</property>
              </packing>
            </child>
            <child>
              <object class="GtkComboBoxText" id="CotationClinique">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="has_entry">True</property>
                <child internal-child="entry">
                  <object class="GtkEntry" id="EntreClinique">
                    <property name="can_focus">False</property>
                    <property name="editable">False</property>
                  </object>
                </child>
              </object>
              <packing>
                <property name="left_attach">0</property>
                <property name="top_attach">2</property>
              </packing>
            </child>
            <child>
              <object class="GtkComboBoxText" id="CotationEconomique">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="has_entry">True</property>
                <child internal-child="entry">
                  <object class="GtkEntry" id="EntreEconomique">
                    <property name="can_focus">False</property>
                    <property name="editable">False</property>
                  </object>
                </child>
              </object>
              <packing>
                <property name="left_attach">1</property>
                <property name="top_attach">2</property>
              </packing>
            </child>
            <child>
              <object class="GtkComboBoxText" id="CotationOrga">
                <property name="visible">True</property>
                <property name="can_focus">False</property>
                <property name="has_entry">True</property>
                <child internal-child="entry">
                  <object class="GtkEntry" id="EntreOrga">
                    <property name="can_focus">False</property>
                    <property name="editable">False</property>
                  </object>
                </child>
              </object>
              <packing>
                <property name="left_attach">2</property>
                <property name="top_attach">2</property>
              </packing>
            </child>
          </object>
          <packing>
            <property name="expand">False</property>
            <property name="fill">True</property>
            <property name="position">2</property>
          </packing>
        </child>
      </object>
    </child>
    <child type="titlebar">
      <placeholder/>
    </child>
  </object>
</interface>
Reply
#3
Hello again
I found the error
It's about the auto completion, I correct the code
self.liststoreMedoc = Gtk.ListStore(str)
self.liststoreMedoc2 = Gtk.ListStore(str)
for s in list(sum(self.ListeMedoc,())):
    self.liststoreMedoc.append([s])
    self.liststoreMedoc2.append([s])
self.autocompletemedoc = Gtk.EntryCompletion()
self.autocompletemedoc2 = Gtk.EntryCompletion()
self.autocompletemedoc.set_model(self.liststoreMedoc)
self.autocompletemedo2c.set_model(self.liststoreMedoc2)
self.autocompletemedoc.set_text_column(0)
self.autocompletemedoc2.set_text_column(0)
self.builder.get_object("EntreMedoc1").set_completion(self.autocompletemedoc)
self.builder.get_object("EntreMedoc2").set_completion(self.autocompletemedoc2)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  GTK3.0 Color Selection Widget Robib 3 266 Nov-04-2021, 04:45 PM
Last Post: Axel_Erfurt
  Gnome GUI with glade ways 0 604 Sep-03-2020, 07:17 PM
Last Post: ways
  Problem with Gtk3 and GLArea gsohler 0 1,228 Aug-12-2019, 07:33 AM
Last Post: gsohler
  Help - GTK3 + Pango: Printing data as table format scandido 0 2,109 Jan-26-2018, 06:03 PM
Last Post: scandido
  python3 + gtk3 image sequence changos 0 2,339 Apr-24-2017, 04:10 PM
Last Post: changos
  Python minesweeper game gtk3 get label value after click lukassz 0 2,219 Mar-25-2017, 08:14 PM
Last Post: lukassz

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020