IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Tkinter Python Discussion :

Conception GUI "complexe"


Sujet :

Tkinter Python

  1. #1
    Membre éclairé
    Avatar de panda31
    Homme Profil pro
    Conseil - Consultant en systèmes d'information
    Inscrit en
    Juin 2003
    Messages
    670
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Conseil - Consultant en systèmes d'information
    Secteur : Conseil

    Informations forums :
    Inscription : Juin 2003
    Messages : 670
    Points : 848
    Points
    848
    Par défaut Conception GUI "complexe"
    Bonjour à tous,

    J'ai un souci d'ordre conception avec Tkinter.
    Je veux construire une GUI comportante plusieurs vues comme ci-dessous:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
     
    --------------------------------------------------------------------
    |                                                            |_|-|X|
    --------------------------------------------------------------------
    | File  Edit  About                                                |
    --------------------------------------------------------------------
    |              |   -----------------------------------    |        |
    |              |   |                                 |    |        |
    |              |   -----------------------------------    |        |
    |              |   |                                 |    |        |
    |              |   -----------------------------------    |        |
    |              |__________________________________________|        |
    |              |                                          |        |
    |              |                                          |        |
    |              |                                          |        |
    |              |                                          |        |
    |              |                                          |        |
    |              |                                          |        |
    --------------------------------------------------------------------
    |     Run      |   Select All   |  Disable All                     |
    --------------------------------------------------------------------
    - La dernière ligne contient des boutons.
    - La première colonne contient une liste de Labels associés à des checkbox
    - Au centre, deux zones de texte et/ou label
    - Troisième colonne, rien.

    Je dois faire ceci en Tkinter et je n'ai aucune idée de par où commencer.
    Pourriez-vous m'aider ? J'ai déjà réalisé des IHM simples en Python/Tkinter mais jamais aussi complexe !
    Je pense qu'il faut utiliser les grids et les frames, un peu comme en Java, mais cela n'a rien d'un Swing !!!

    Pouvez-vous me donner quelques pistes d'étude svp ?

    Merci d'avance

  2. #2
    Membre averti
    Inscrit en
    Janvier 2007
    Messages
    329
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 329
    Points : 366
    Points
    366
    Par défaut
    Salut,

    En effet, la méthode la plus simple consiste à faire une grille dans laquelle tu mets des frames contenant d'autres sous-grilles, ainsi de suite.

    Ce bout de code devrait t'aider :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    import Tkinter
     
    class MonProg(Tkinter.Tk):
        def __init__(self):
            Tkinter.Tk.__init__(self)
            self.rowconfigure(1, weight=1)
            self.columnconfigure(0, weight=1)
            labels = ["Pomme","Abricot","Banane","Kiwi","Noisette","Fraise","Orange"]
            # MENU ----------------------------------
            self.f_top = Tkinter.Frame(self)
            self.f_top.grid(row=0, column=0, sticky=Tkinter.W)
            self.menub1 = Tkinter.Menubutton(self.f_top, text="File")
            self.menub1.grid(row=0, column=0, sticky=Tkinter.W)
            self.menub2 = Tkinter.Menubutton(self.f_top, text="Edit")
            self.menub2.grid(row=0, column=1, sticky=Tkinter.W)
            self.menub3 = Tkinter.Menubutton(self.f_top, text="About")
            self.menub3.grid(row=0, column=2, sticky=Tkinter.W)
            # MILIEU --------------------------------
            self.f_middle = Tkinter.Frame(self)
            self.f_middle.grid(row=1, column=0)
            # Milieu gauche
            self.f_left = Tkinter.Frame(self.f_middle)
            self.f_left.grid(row=0, column=0)
            self.checkb = []
            for l in labels:
                c = Tkinter.Checkbutton(self.f_left, text=l)
                c.var = Tkinter.IntVar()
                c.configure(variable=c.var)
                c.pack(side=Tkinter.TOP, anchor='nw')
                self.checkb.append(c)
            # Milieu centre
            self.f_center = Tkinter.Frame(self.f_middle)
            self.f_center.grid(row=0, column=1, sticky=Tkinter.W)
            self.l1 = Tkinter.Label(self.f_center, text="Label 1")
            self.l1.pack(anchor='nw')
            self.l2 = Tkinter.Label(self.f_center, text="Label 2")
            self.l2.pack(anchor='nw')
            # Milieu droit
            self.f_right = Tkinter.Frame(self.f_middle)
            self.f_right.grid(row=0, column=2)
            # BAS -----------------------------------
            self.f_bottom = Tkinter.Frame(self)
            self.f_bottom.grid(row=2, column=0)
            for b in [("Run",self.run), ("Select all",self.select_all), ("Disable all",self.deselect_all)]:
                Tkinter.Button(self.f_bottom, text=b[0], command=b[1]).pack(side=Tkinter.LEFT)
            return
     
        def select_all(self):
            #[_.select() for _ in self.checkb]
            map(lambda w: w.select(), self.checkb)
            return
     
        def deselect_all(self):
            #[_.deselect() for _ in self.checkb]
            map(lambda w: w.deselect(), self.checkb)
            return
     
        def run(self):
            for c in self.checkb:
                print c.cget('text'), c.var.get()
            return
     
    if __name__ == '__main__':
        MonProg().mainloop()
    (c'est du vite-fait, y'a moyen de l'améliorer)

  3. #3
    Membre éclairé
    Avatar de panda31
    Homme Profil pro
    Conseil - Consultant en systèmes d'information
    Inscrit en
    Juin 2003
    Messages
    670
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Conseil - Consultant en systèmes d'information
    Secteur : Conseil

    Informations forums :
    Inscription : Juin 2003
    Messages : 670
    Points : 848
    Points
    848
    Par défaut cool!
    Merci pour cette réponse qui me trace déjà pas mal la route à suivre. Saurais-tu où trouver de la doc à ce sujet à tout hasard stp ? On ne peut pas dire que le Web ou les différents ouvrages que j'ai consultés soient d'une grande aide.

    Mais j'ai trafiqué un peu ton code pour m'approprier les principes à mettre en oeuvre et je me rends compte que c'est outrageusement verbeux ! Pourquoi n'est-ce pas comme Swing ? Un bon petit BorderLayout dans lequel tu joues avec la boussole (S,N,W,E) !

    RRRRaaaah mais je me fais du mal. Bon je m'y mets et je vous tiens au jus.

    Merci encore monnomamoi !

  4. #4
    Membre averti
    Inscrit en
    Janvier 2007
    Messages
    329
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 329
    Points : 366
    Points
    366
    Par défaut
    Disons que Tkinter, c'est bien pour un GUI à 3 boutons maxi ; au-delà, c'est dépassé.

    Moi je préfère largement pyGTK (sous Linux). Il paraît que wxPython est très bien aussi, mais j'ai pas eu l'occasion de tester à fond.


    Sinon, pour la doc, regarde ici :
    http://www.developpez.net/forums/d15...ntation-liens/
    http://python.developpez.com/faq/?page=Tkinter
    http://infohost.nmt.edu/tcc/help/pubs/tkinter/

    Bonne chance pour la suite

    -

  5. #5
    Membre éclairé
    Avatar de panda31
    Homme Profil pro
    Conseil - Consultant en systèmes d'information
    Inscrit en
    Juin 2003
    Messages
    670
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Conseil - Consultant en systèmes d'information
    Secteur : Conseil

    Informations forums :
    Inscription : Juin 2003
    Messages : 670
    Points : 848
    Points
    848
    Par défaut Solaris...
    Entièrement d'accord sur le fait que Tkinter n'est pas optimal pour ce genre de traitement... Mais je n'ai pas le choix vu que le projet est destiné à tourner sous Unix par émulateur.
    Sinon, je sais que dans ma boîte, ils sont pas mal accros à PyQT. J'ai regardé quelques exemples et ça semble plutôt bien construit comme code.

  6. #6
    Membre éclairé
    Avatar de panda31
    Homme Profil pro
    Conseil - Consultant en systèmes d'information
    Inscrit en
    Juin 2003
    Messages
    670
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Conseil - Consultant en systèmes d'information
    Secteur : Conseil

    Informations forums :
    Inscription : Juin 2003
    Messages : 670
    Points : 848
    Points
    848
    Par défaut again
    Bonjour,

    Voici ce que j'ai réussi à faire (image attachée) ! Merci pour l'aide apportée.

    J'ai un autre souci... Oui encore.

    En fait, je voudrais pouvoir créer dynamiquement des boutons et leur associer une action.

    Par exemple j'ai une liste ['a','b','c','d']
    Je veux donc obtenir 4 boutons A B C et D.
    Sous chaque bouton, j'ai une liste de checkbox.

    Quand je clique sur A, je veux que mes checkbox sous A soient sélectionnées.
    Idem pour les autres.

    J'avais pensé faire simplement :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
     
            for sect in self.process.sections:            
                b_sect = Tkinter.Button(self.f_left, text=sect.name, command=self.select_section,width=15).pack()                    
                for act in sect.actions:
                    c_act = Tkinter.Checkbutton(self.f_left, text=act.name)
                    c_act.var = Tkinter.IntVar()
                    c_act.configure(variable=c_act.var)
                    c_act.pack(side=Tkinter.TOP, anchor='nw')
                    self.checkb.append(c_act)
    Mais le problème c'est que je sais pas comment différencier les appels à select_section. Peut-on savoir d'où vient l'appel ? Quel bouton l'a passé ? Un petit event de derrière les fagots peut-être ?

    Quand on regarde l'image attachée dans ce message, les boutons construits dynamiquement sont "Export Source" et "Validate".

    [EDIT=refresh de la vue]
    Encore, comment peut-on mettre à jour l'affichage ?
    Ex: Je charge un nouveau process et je veux mettre à jour mes labels, mes boutons construits dynamiquement, mes checkbox...

    Je trouve pas. Je vois pas trop quoi faire de la fonction update() en fait.
    Ma conception est peut-être mauvaise.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    # -*- coding: ISO-8859-1 -*-
    import Tkinter
    from Action import Action
    from Section import Section
    from Process import Process
    from xml.dom.minidom import Document,parse
    from os.path import isfile
     
    class SapristiGUI:
        def __init__(self,process):
            self.etat = 0
            self.root = Tkinter.Tk()
            self.root.rowconfigure(1, weight=1)
            self.root.columnconfigure(0, weight=1)
            # Set process
            self.process = process
            # Set title of main window 
            self.root.title(self.process.name)
            # MILIEU --------------------------------
            self.center()
            # BAS -----------------------------------
            self.bottom()
            # MENU ----------------------------------
            self.menu()
            # Launch GUI
            self.root.protocol("WM_DELETE_WINDOW", self.catchClose)
            self.root.mainloop()
     
        def menu(self):
            # Place Frame for menu at North
            self.f_top = Tkinter.Frame(self.root,width=200,height=500)
            # Frame f_top at first line, first column and sticks to West side
            self.f_top.grid(row=0, column=0, sticky=Tkinter.W)
            # Add menu File
            self.menuFile = Tkinter.Menubutton(self.f_top, text="File")
            # Add commands in File
            m_file = Tkinter.Menu(self.menuFile)
            self.menuFile.configure(menu=m_file)
            m_file.add_command(label='Open',command=self.catchOpen)
            m_file.add_command(label='Quit',command=self.catchClose)
            # Place menu File as first element in frame f_top
            self.menuFile.grid(row=0, column=0, sticky=Tkinter.W)                        
            # Add menu Edit
            self.menuEdit = Tkinter.Menubutton(self.f_top, text="Edit")
            # Place menu Edit as second element in frame f_top
            self.menuEdit.grid(row=0, column=1, sticky=Tkinter.W)
            # Add menu About
            self.menuAbout = Tkinter.Menubutton(self.f_top, text="About")
            # Place menu About as third element in frame f_top
            self.menuAbout.grid(row=0, column=2, sticky=Tkinter.W)
     
        def center(self):
            self.f_middle = Tkinter.Frame(self.root)
            self.f_middle.grid(row=1, column=0)
     
            #------------------
            #    Middle West
            #------------------
            self.f_left = Tkinter.Frame(self.f_middle)
            self.f_left.grid(row=0, column=0)
            self.checkb = []
            self.b_sect = []
            for sect in self.process.sections:            
                self.b_sect.append(Tkinter.Button(self.f_left, text=sect.name, command=self.select_section,width=15).pack())        
                for act in sect.actions:
                    c_act = Tkinter.Checkbutton(self.f_left, text=act.name)
                    c_act.var = Tkinter.IntVar()
                    c_act.configure(variable=c_act.var)
                    c_act.pack(side=Tkinter.TOP, anchor='nw')
                    self.checkb.append(c_act)
     
     
     
            #------------------
            #      Middle
            #-------------------
            # Current action thread frame       
            self.f_running = Tkinter.LabelFrame(self.f_middle,text="Running",width=100,height=100)
            self.f_running.grid(row=0,column=1,sticky=Tkinter.W)
            # Name of the current action thread
            self.runningLab = Tkinter.StringVar()
            Tkinter.Label(self.f_running, textvariable=self.runningLab).pack()
            self.setRunningLab("<action name>")
            # List of arguments of the current action thread
            self.argList = Tkinter.Text(self.f_running,width=50,height=15)
            self.argList.insert(Tkinter.END, 'None\n')
            self.argList.pack()
     
            # Log frame
            self.f_log = Tkinter.LabelFrame(self.f_middle,text="Log",width=100,height=100)
            self.f_log.grid(row=1,column=1,sticky=Tkinter.W)
            # Log text box
            self.logText = Tkinter.Text(self.f_log,width=50,height=15)       
            self.logText.pack()
     
            #------------------
            #    Middle East
            #------------------
            self.f_right = Tkinter.Frame(self.f_middle)
            self.f_right.grid(row=0, column=2,sticky=Tkinter.E)
     
        def bottom(self):
            self.f_bottom = Tkinter.Frame(self.root)
            self.f_bottom.grid(row=2, column=0)
            lbuttons = [("Run",self.run),\
                        ("Select all",self.select_all),\
                        ("Disable all",self.disable_all),\
                        ("Clear log",self.clearLog)]
            for b in lbuttons:
                Tkinter.Button(self.f_bottom, text=b[0], command=b[1],width=10).pack(side=Tkinter.LEFT)
            b = ("Panic!",self.panic)
            bpanic = Tkinter.Button(self.f_bottom, text=b[0], command=b[1],width=10,bg="red",border=6)
            bpanic.pack(side=Tkinter.RIGHT)  
            bpanic.configure()
     
     
        def select_all(self):
            #[_.select() for _ in self.checkb]
            map(lambda w: w.select(), self.checkb)
            self.setRunningLab("Select all!")
            return
     
        def select_section(self):        
    #        map(lambda w: w.select(), self.checksect[sectName])
            if self.etat == 0:
                self.etat = 1
                print 'section sélectionnée'
            else:
                self.etat = 0
                print 'section désélectionnée'            
     
        def disable_all(self):
            #[_.deselect() for _ in self.checkb]
            self.setRunningLab("Disable all!")
            map(lambda w: w.deselect(), self.checkb)
            return
     
        def run(self):
            # @TODO: branch to action path creating a thread for each action
            # @TODO: Update labels while running
            # @TODO: Update log while running
            # @TODO: Update log file with success and fails and warn user
            self.logText.insert(Tkinter.END,self.process.name+'\n')
            for c in self.checkb:
                if (c.var.get() == 1):
                    self.setRunningLab(c.cget('text'))
     
                    i=0
                    while(i<1e+6):
                        i = i + 1   
            self.setRunningLab('-')       
            pid = 0
            return pid
     
        def setRunningLab(self,text):
            self.runningLab.set(str(text))
     
        def clearLog(self):
            self.logText.delete(1.0, Tkinter.END)
     
        def panic(self):
            pass
     
        def catchOpen(self):                      
            from tkFileDialog   import askopenfilename
            from ProcessParser import ProcessParser
            processFile = askopenfilename()
            # @TODO: Validate XML process file
            dom = parse(processFile)
            self.process = ProcessParser().extractProcess(dom)        
            # @TODO: Update display
            self.refresh()        
     
        def catchClose(self):   
            self.root.destroy()
     
        def refresh(self):
            # Set title of main window 
            self.root.title(self.process.name)
     
     
     
    if __name__ == '__main__':
        # Construction à la main du processus
        args = ['SRC','1','mika']
        act = Action('test',0,'test.ksh',args)
        act.setHelp('This action allows to test new Action func')
     
        args = ['0']
        act2 = Action('act',1,'act.ksh',args)
        act2.setHelp('toto')
        act3 = Action('test',1,'test.py',args)
     
        sect = Section('Export Source', 1)
        sect.actions.append(act)
        sect.actions.append(act2)
        sect.actions.append(act3)
        sect.setHelp('section test')
     
        sect2 = Section('Validate',0)
        sect2.actions.append(act2)
     
        proc = Process('ProcessTest',0)
        proc.sections.append(sect)
        proc.sections.append(sect2)
        proc.setHelp('process test')
     
        sap = SapristiGUI(proc)
    Le code ne doit pas être parfait mais j'ai essayé de séparé un peu tout dans des fonctions à part. A mon gout, il y a trop de self.xxx. Je ne sais pas trop comment remanier ce code pour obtenir une bonne conception et pouvoir faire un refresh de la vue (càd, tout supprimer puis tout refaire)
    [/EDIT]

    Merci d'avance

    PS: Quand j'aurais fini ce projet, je pense qu'il serait bien que je fasse un tuto pour ceux qui connaitraient les mêmes difficultés que moi.
    Images attachées Images attachées  

  7. #7
    Membre averti
    Inscrit en
    Janvier 2007
    Messages
    329
    Détails du profil
    Informations forums :
    Inscription : Janvier 2007
    Messages : 329
    Points : 366
    Points
    366
    Par défaut
    Bon, j'ai pas regardé le code en détail, mais je vais essayer de répondre.

    Pour créer dynamiquement les boutons/checkbox, stocke-les par exemple dans une liste :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    boutons = [("export source", ["test","act"]), ("validate", ["act"])]
    => ce sera facile à parcourir.

    Ensuite, stocke aussi ton self.checkb dans une liste du genre :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    self.checkb = [(bouton_exportsource, [checkb_test, checkb_act_1]), (bouton_validate, [checkb_act_2])]
    (à construire dans le prog)


    Pour savoir quel bouton a été cliqué, fais par exemple :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    b_sect = Tkinter.Button(self.f_left, text=sect.name, width=15).pack()
    b_sect.configure(command=lambda: self.select_section(b_sect))
    ...
    def select_section(self, bouton):
        for cb in [ _[1] for _ in self.checkb if _[0] == bouton ][0]:
            cb.select()
    Pour mettre à jour l'affichage, la fonction "update()" permet par exemple de rafraichir un Label dont on a changé le texte.
    Pour reconstruire ton interface totalement, destroy le widget parent et rappelle __init__(). Si tu ne veux pas perdre les données dans ta classe, sépare le graphisme dans une classe mère et les les données dans une classe fille qui hérite de la classe graphique, comme ça y'a qu'à faire __init__ sur la classe GUI.

  8. #8
    Membre éclairé
    Avatar de panda31
    Homme Profil pro
    Conseil - Consultant en systèmes d'information
    Inscrit en
    Juin 2003
    Messages
    670
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Conseil - Consultant en systèmes d'information
    Secteur : Conseil

    Informations forums :
    Inscription : Juin 2003
    Messages : 670
    Points : 848
    Points
    848
    Par défaut
    Merci encore... et encore

    Création des boutons et des checkbox
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    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
     
            #------------------
            #    Middle West
            #------------------
            self.f_left = Tkinter.Frame(self.f_middle)
            self.f_left.grid(row=0, column=0)
     
            # Remplissage des noms des boutons et des check box
            buttonsAndCheckBoxName = {}
            for sect in self.process.sections:
                actionsName = []
                for act in sect.actions:
                    actionsName.append(act.name)
                buttonsAndCheckBoxName[sect.name] = actionsName
     
            # Création des boutons de section et des checkbox
            for bname, lacname in buttonsAndCheckBoxName.items():
                but = Tkinter.Button(self.f_left, text=bname, command=lambda xb=but: self.select_section(xb),width=15).pack()
                lcheck = []
                for acname in lacname:
                    c_act = Tkinter.Checkbutton(self.f_left, text=acname)
                    c_act.var = Tkinter.IntVar()
                    c_act.configure(variable=c_act.var)
                    c_act.pack(side=Tkinter.TOP, anchor='nw')
                    lcheck.append(c_act)
                self.buttons[but] = lcheck
    Fonction callback select_section
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
     
        def select_section(self,but):        
    #        map(lambda w: w.select(), self.checksect[sectName])
            if self.etat == 0:
                self.etat = 1
                map(lambda w: w.select(), self.boutons[but])
                print 'section sélectionnée'
                print but
            else:
                self.etat = 0
                map(lambda w: w.deselect(), self.boutons[but])
                print 'section désélectionnée'
                print but
    En procédant ainsi, j'obtiens None dans button... Je vois pas pourquoi ? Disable_all et Select_all ne fonctionnent plus du coup...

    [EDIT: Merci Guigui, cela est bon mtnt. J'ai corrigé]

    J'avoue mon impuissance sur ces bouts de code. J'ai l'impression que de passer le bouton en paramètre ne fonctionne pas, même en passant par une lambda.

    Concernant le refresh, c'est bon cela fonctionne super. Je pensais que cela serait plus compliqué que cela.

    Quand j'aurais réussi à finir ceci (boutons/checkbox/select all/disable all/select section...), il ne me restera plus qu'à trouver comment envoyer la sortie erreur+standard des actions que j'exécute (soit en direct Popen soit par thread) dans la fenêtre de log...

  9. #9
    Expert éminent sénior
    Avatar de Guigui_
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Août 2002
    Messages
    1 864
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Enseignement

    Informations forums :
    Inscription : Août 2002
    Messages : 1 864
    Points : 10 067
    Points
    10 067

  10. #10
    Membre éclairé
    Avatar de panda31
    Homme Profil pro
    Conseil - Consultant en systèmes d'information
    Inscrit en
    Juin 2003
    Messages
    670
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 40
    Localisation : France

    Informations professionnelles :
    Activité : Conseil - Consultant en systèmes d'information
    Secteur : Conseil

    Informations forums :
    Inscription : Juin 2003
    Messages : 670
    Points : 848
    Points
    848
    Par défaut
    Oui Guigui, tu peux me lapider... Merci


    [EDIT: Merci à vous 2. Ca marche !/]

+ Répondre à la discussion
Cette discussion est résolue.

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo