<div dir="ltr"><br><div class="gmail_extra"><br>> cmq i problemi rimarranno se blocchi il mainloop lanciando dei processi esterni<div class="gmail_quote"> > e questo mi fa pensare che ho ragione.<br><br></div><div class="gmail_quote">
Si effettivamente il problema è proprio il blocco della mainloop.<br><br></div><div class="gmail_quote">Ho provato ad utilizzare Tread, ma ottengo lo stesso risultato<br><br>from threading import Thread<br>from gi.repository import Gtk<br>
class Windows(object):<br><br>    def __init__(self):<br>        self.ApplicazioneGlade = Gtk.Builder()<br>        self.ApplicazioneGlade.add_from_file(PercorsoGlade)<br>        self.ApplicazioneGlade.connect_signals(self)<br>
        self.statusbar = self.ApplicazioneGlade.get_object('statusbar')<br>        self.context_id = self.statusbar.get_context_id('statusbar')<br>        self.statusbar.push(self.context_id, 'Status . . . . . . . ')<br>
    <br>    def run(self, *args):<br>    <br>        self.ApplicazioneGlade.get_object("FinestraPrincipale").show()<br>        self.model = Gtk.ListStore(str,str,str,str,str)<br>        elencoimpianti = self.ApplicazioneGlade.get_object('ElencoImpianti')<br>
        elencoimpianti.get_selection().set_mode(Gtk.SelectionMode.SINGLE)<br>        col1,col2,col3,col4,col5 = range(5)<br>        elencoimpianti.set_model(self.model)<br>        cell = Gtk.CellRendererText()<br>        column2 = Gtk.TreeViewColumn("- Nome Impianto -", cell, text = col2)<br>
        column2.set_resizable (True)<br>        column2.set_sort_column_id(col2)<br>        elencoimpianti.append_column (column2)<br>        column3 = Gtk.TreeViewColumn("- Codice Impianto -", cell, text = col3)<br>
        column3.set_resizable (True)<br>        column3.set_sort_column_id(col3)<br>        elencoimpianti.append_column (column3)<br>        column4 = Gtk.TreeViewColumn(" Pers ", cell, text = col4)<br>        column4.set_resizable (True)<br>
        column4.set_sort_column_id(col4)<br>        elencoimpianti.append_column (column4)<br>        column5 = Gtk.TreeViewColumn(" -PBX- ", cell, text = col5)<br>        column5.set_resizable (True)<br>        column5.set_sort_column_id(col5)<br>
        elencoimpianti.append_column (column5)        <br>        datiDB = pyodbc.connect('DRIVER={};DBQ={};PWD={}'.format(DriverMDB,PercorsoMDB,PwdMDB))<br>        cur = datiDB.cursor()<br>        cur.execute("select CapoImpianto,NomeImpianto,CodiceImpianto,NomeSW,TipoCentrale from Impianti where Gestione = '"+gestione+"'")<br>
        dati = cur.fetchall()<br>        for dato in dati:<br>            if str(dato[0]) == "None":<br>                var1= ''<br>            else:<br>                var1=str(dato[0])<br>            var2=str(dato[1])<br>
            var3=str(dato[2])<br>            var4=str(dato[3])<br>            if str(dato[4]) == "None":<br>                var5= ''<br>            else:<br>                var5=str(dato[4])<br>            record = self.model.append([var1,var2,var3,var4,var5])<br>
        cur.close()<br>        datiDB.close()<br>        Gtk.main()<br>    <br>    def on_statusbar_show(self, button,obj,data=None):<br>        self.statusbar = self.ApplicazioneGlade.get_object('statusbar')<br>        self.context_id = self.statusbar.get_context_id('statusbar')<br>
        self.statusbar.push(self.context_id, self.MessaggioStatusbar)<br><br>    def on_VerTab_clicked(self, button):<br>        self.MessaggioStatusbar = 'Hai premuto Verifica Tabella'<br>        thread1 = Thread(target=self.on_statusbar_show(self, button,data=None),args=[])<br>
        thread1.start()<br>        thread1.join()        <br>                <br>        thread2 = Thread(target=self.on_VerTab_clicked2(self),args=[])<br>        thread2.start()<br>        thread2.join()<br>    <br>    def on_VerTab_clicked2(self, button):<br>
        ... codice che controlla parecchi file di testo ......<br></div><div class="gmail_quote">        ... insert INTO DB .........<br></div><div class="gmail_quote">Windows().run()    <br><br></div><div class="gmail_quote">
  <br><br></div><div class="gmail_quote">Posso risolvere questo problema facilmente senza stravolgere il programma?<br><br></div><div class="gmail_quote">Ciao<br></div><div class="gmail_quote">Marcello<br></div><div class="gmail_quote">
<br></div></div></div>