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 :

mettre une toplevel au premier plan


Sujet :

Tkinter Python

  1. #1
    Membre régulier
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    262
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2005
    Messages : 262
    Points : 93
    Points
    93
    Par défaut mettre une toplevel au premier plan
    Bonjour à tous,

    Voici mon script:

    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
    # python3
    # -*- coding: utf-8 -*-
     
    from tkinter import ttk
    import tkinter ,time
     
    class MaFenetre():
        def __init__(self):
            """ fenêtre principale"""
            self.root= tkinter.Tk()
            self.root.geometry("1200x900")
            self.root.title("fenetre principale")
            self.text1=tkinter.Text(self.root,width=33)
            self.text1.pack()
            self.ouvrirProgressBar()
            for t in range(10):
                    self.text1.insert(tkinter.INSERT,t)
                    self.text1.insert(tkinter.INSERT,"\t")
                    time.sleep(0.1)
     
        def ouvrirProgressBar(self):
            """ fenetre secondaire (ProgressBarr)"""        
            self.f2=tkinter.Toplevel()
            self.f2.title("fenetre ProgressBar")
            self.f2.focus()
            # progressBar :
            self.pbar = ttk.Progressbar(self.f2, length=300)
            self.pbar.pack()
            self.pbar.start()
     
    if __name__=='__main__':     
        fen=MaFenetre()    
        fen.root.mainloop()
    Bien naturellement, je voudrais que ma self.f2 s'affiche au premier plan alors que dans cet exemple elle est cachée en arrière plan et cela malgré l'instruction : self.f2.focus().

    Le but recherché est d'afficher self.f2 au dessus de self.root en attendant que celle-ci affiche tout son contenu.

    Merci d'avance à qui pourra m'aider.

  2. #2
    Membre régulier
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    262
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2005
    Messages : 262
    Points : 93
    Points
    93
    Par défaut
    Ok, mon problème et en partie résolu grâce à:

    .transient ( parent=None )
    Make this window a transient window for some parent window; the default parent window is this window's parent.

    This method is useful for short-lived pop-up dialog windows. A transient window always appears in front of its parent. If the parent window is iconified, the transient is iconified as well.



    ce qui donne:
    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
    # python3
    # -*- coding: utf-8 -*-
     
    from tkinter import ttk
    import tkinter ,time
     
    class MaFenetre():
        def __init__(self):
            """ fenêtre principale"""
            self.root= tkinter.Tk()
            self.root.geometry("1200x900")
            self.root.title("fenetre principale")
            self.text1=tkinter.Text(self.root,width=33)
            self.text1.pack()
            self.ouvrirProgressBar()        
     
     
        def ouvrirProgressBar(self):
            """ fenetre secondaire (ProgressBarr)"""
            self.f2=tkinter.Toplevel( )
            self.f2.transient(self.root)
            self.f2.title("fenetre ProgressBar")
            # progressBar :
            self.pbar = ttk.Progressbar(self.f2, mode='indeterminate' ,length=300)
            self.pbar.pack()
            self.pbar.start()
     
        def affichage(self):
            for t in range(10):
                    self.text1.insert(tkinter.INSERT,t)
                    self.text1.insert(tkinter.INSERT,"\t")
                    time.sleep(1)  
     
    if __name__=='__main__':     
        fen=MaFenetre()
        fen.affichage()    
        fen.root.mainloop()
    Reste un hic... l'affichage des 2 fenêtres ne se fait que lorsque self.root a affiché toutes ses données. Manifestement il y quelque chose qui m'échappe concernant l'utilisation de cette progressBarr..

  3. #3
    Membre actif
    Profil pro
    Inscrit en
    Décembre 2007
    Messages
    222
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2007
    Messages : 222
    Points : 290
    Points
    290
    Par défaut
    En fait le time.sleep bloque ton programme, c'est pour ça que l'affichage se fait qu'à la fin de ta méthode affichage.
    Je suis sur python 2.6, je peux donc pas tester ton programme, mais je pense que tu peux aller voir du coté des thread (ça lance un processus en parallèle).

    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
     
    # python3
    # -*- coding: utf-8 -*-
     
    from tkinter import ttk
    import tkinter ,time, threading
     
    class MaFenetre():
        def __init__(self):
            """ fenêtre principale"""
            self.root= tkinter.Tk()
            self.root.geometry("1200x900")
            self.root.title("fenetre principale")
            self.text1=tkinter.Text(self.root,width=33)
            self.text1.pack()
            self.ouvrirProgressBar()        
     
     
        def ouvrirProgressBar(self):
            """ fenetre secondaire (ProgressBarr)"""
            self.f2=tkinter.Toplevel( )
            self.f2.transient(self.root)
            self.f2.title("fenetre ProgressBar")
            # progressBar :
            self.pbar = ttk.Progressbar(self.f2, mode='indeterminate' ,length=300)
            self.pbar.pack()
            self.pbar.start()
     
        def affichage(self):
            for t in range(10):
                    self.text1.insert(tkinter.INSERT,t)
                    self.text1.insert(tkinter.INSERT,"\t")
                    time.sleep(1)  
     
    if __name__=='__main__':     
    	fen=MaFenetre()
    	a = threading.Thread(target=fen.affichage)
    	a.start()
    	fen.root.mainloop()
    J'ai pas testé le code, tu me diras si ça marche.

  4. #4
    Membre régulier
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    262
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2005
    Messages : 262
    Points : 93
    Points
    93
    Par défaut
    Pour l'instant ce code ne fonctionne pas: le programme se bloque. Quoiqu'il en soit je pense que tu as raison et qu'il convient d'utiliser les threads. J'essaye donc dans ce sens et si je trouve la solution je la reposte ici.
    Merci pour ton aide.

  5. #5
    Membre régulier
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    262
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2005
    Messages : 262
    Points : 93
    Points
    93
    Par défaut
    Oui ton scrit fonctionne sous réserve d'ajouter une ligne.

    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
    # python3
    # -*- coding: utf-8 -*-
     
    from tkinter import ttk
    import tkinter ,time, threading
     
    class MaFenetre():
        def __init__(self):
            """ fenêtre principale"""
            self.root= tkinter.Tk()
            self.root.geometry("1200x900")
            self.root.title("fenetre principale")
            self.text1=tkinter.Text(self.root,width=33)
            self.text1.pack()
            self.text1.insert(tkinter.INSERT,' ') # Il s'agit d'1 espace et non pas d'1 chaîne vide!
            self.ouvrirProgressBar()        
            
     
        def ouvrirProgressBar(self):
            """ fenetre secondaire (ProgressBarr)"""
            self.f2=tkinter.Toplevel( )
            self.f2.transient(self.root)
            self.f2.title("fenetre ProgressBar")
            # progressBar :
            self.pbar = ttk.Progressbar(self.f2, mode='indeterminate' ,length=300)
            self.pbar.pack()
            self.pbar.start()
     
        def affichage(self):
            for t in range(10):
                    self.text1.insert(tkinter.INSERT,t)
                    self.text1.insert(tkinter.INSERT,"\t")
                    time.sleep(1)  
     
    if __name__=='__main__':     
    	fen=MaFenetre()
    	a = threading.Thread(target=fen.affichage)
    	a.start()
    	fen.root.mainloop()

  6. #6
    Expert confirmé Avatar de PauseKawa
    Homme Profil pro
    Technicien Help Desk, maintenance, réseau, système et +
    Inscrit en
    Juin 2006
    Messages
    2 725
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Technicien Help Desk, maintenance, réseau, système et +
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2006
    Messages : 2 725
    Points : 4 005
    Points
    4 005
    Par défaut
    Citation Envoyé par Chris33 Voir le message
    Oui ton scrit fonctionne sous réserve d'ajouter une ligne.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    # python3
            self.text1.insert(tkinter.INSERT,' ') # Il s'agit d'1 espace et non pas d'1 chaîne vide!
    Bonjour Chris33,

    Juste une question :
    Pourquoi le code de nyko77 ne fonctionne t'il pas sans cette ligne ?
    Cela viens t'il de Python 3 ? (pour moi c'est bon en 2.6)
    Désolé pour la question mais je suis limité au développement en 2.6 mais j'essaie d'avoir un code 'portable'.

    Pour nyko77:

    Citation Envoyé par nyko77 Voir le message
    Je suis sur python 2.6, je peux donc pas tester ton programme
    Tkinter n'est qu'un wrapper, si tu est en 8.5 regarde de ce coté

    Renomme le ttk.py en Ttk.py

    Remplace les imports de Chris33 par:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    from sys import version_info
    if version_info[0] == 2:
        import Tkinter as tkinter
        import Ttk as ttk
    else:
        from tkinter import ttk
        import tkinter
    import time, threading
    Goute aux plaisir de style ou encore Notebook

    @+

  7. #7
    Membre régulier
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    262
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2005
    Messages : 262
    Points : 93
    Points
    93
    Par défaut
    Bonjour
    tu me demandes:

    Pourquoi le code de nyko77 ne fonctionne t'il pas sans cette ligne ?
    Cela viens t'il de Python 3 ? (pour moi c'est bon en 2.6)

    Je ne sais pas pourquoi mais sans cette ligne le programme se bloque complétement.

    autre chose, si je modifie:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    def affichage(self):
            for t in range(4):
                    self.text1.insert(tkinter.INSERT,t)
                    self.text1.insert(tkinter.INSERT,"\t")
                    time.sleep(1)  
            self.f2.destroy()
    la progressbar s'arrête mas self.f2 n'est pas détruite.

  8. #8
    Expert confirmé Avatar de PauseKawa
    Homme Profil pro
    Technicien Help Desk, maintenance, réseau, système et +
    Inscrit en
    Juin 2006
    Messages
    2 725
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Technicien Help Desk, maintenance, réseau, système et +
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2006
    Messages : 2 725
    Points : 4 005
    Points
    4 005
    Par défaut
    Bonjour,

    Citation Envoyé par Chris33 Voir le message
    Je ne sais pas pourquoi
    Et bien moi non plus (je n'arrive pas a reproduire le problème)

    Par contre puisque Progressbar est la pour faire une barre de progression (si si) je ne vois pas l'intérêt de threading.

    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
    # -*- coding: utf-8 -*-
    #
    #
    #
    from sys import version_info
    if version_info[0] == 2:
        import Tkinter as tkinter
        import Ttk as ttk
    else:
        from tkinter import ttk
        import tkinter
    import time, threading
     
    class MaFenetre():
        def __init__(self):
            """ fenêtre principale"""
            self.root= tkinter.Tk()
            self.root.geometry("1200x900")
            self.root.title("fenetre principale")
            self.text1=tkinter.Text(self.root,width=33)
            self.text1.pack()
            self.text1.insert(tkinter.INSERT,' ') # Il s'agit d'1 espace et non pas d'1 chaîne vide!
            self.ouvrirProgressBar()
     
        def ouvrirProgressBar(self):
            """ fenetre secondaire (ProgressBarr)"""
            self.f2=tkinter.Toplevel( )
            self.f2.transient(self.root)
            self.f2.title("fenetre ProgressBar")
            # progressBar :
            self.pbar = ttk.Progressbar(self.f2, mode='indeterminate' ,length=300)
            self.pbar.pack()
            self.pbar.start()
            self.affichage(0)
     
        def affichage(self, t):
            if t<10:
                self.text1.insert(tkinter.INSERT,t)
                self.text1.insert(tkinter.INSERT,"\t")
                self.root.after(5000, lambda:self.affichage(t+1))
            else: self.pbar.stop()
     
    if __name__=='__main__':     
        fen=MaFenetre()
        fen.root.mainloop()
    @+

    Edit : L'import time, threading est inutile bien sur.

  9. #9
    Membre régulier
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    262
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2005
    Messages : 262
    Points : 93
    Points
    93
    Par défaut
    Merci pour ta réponse.

    Je reprends tes explications et modifie ce script pour l'adapter à mes besoins:

    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
    # python3
    # -*- coding: utf-8 -*-
    
    
    
    from sys import version_info
    if version_info[0] == 2:
        import Tkinter as tkinter
        import Ttk as ttk
    else:
        from tkinter import ttk
        import tkinter
    import time, threading
    
    
    thread_resultat=[]
    
    class Monthread (threading.Thread):
        def __init__(self,win,res):
            threading.Thread.__init__(self)
            self.win=win # je mémorise une référence pour la fenêtre
            self.res=res # pour mémoriser le résultat.
        def run(self):        
            time.sleep(3)
            resultat="toutes mes donnees"
            self.res.append(resultat)
            self.win.event_generate("<<treadFini>>")
     
    class MaFenetre(object):
        def __init__(self):
            """ fene principale"""
            self.root= tkinter.Tk()
            self.root.geometry("400x200+200+200")
            self.root.title("fenetre principale")
            self.text1=tkinter.Text(self.root,width=33)
            self.text1.pack()
    
            self.ouvrirProgressBar()
            self.lance_thread()
            
     
        def ouvrirProgressBar(self):
            """ fenetre secondaire (ProgressBarr)"""
            self.f2=tkinter.Toplevel( )
            self.f2.transient(self.root)
            self.f2.title("fenetre ProgressBar")
            # progressBar :
            self.pbar = ttk.Progressbar(self.f2, mode='indeterminate' ,length=300)
            self.pbar.pack()
            self.pbar.start()
    
    
        def lance_thread(self):
            """ Dans le script final, cette méthode lancera 3 threads de cette manière."""
            global thread_resultat
            m=Monthread(self.root,thread_resultat)
            m.start()
     
     
    def treadFini(a):
    	global thread_resultat
    	texte=thread_resultat[0]
    	fen.text1.insert('1.0',texte)
    	fen.f2.geometry("10x10")
    	#fen.f2.destroy()
    if __name__=='__main__': 
    	fen=MaFenetre()
    	fen.root.bind("<<treadFini>>",treadFini)  
    	fen.root.mainloop()
    Pourquoi la ligne fen.f2.destroy() ne fonctionne t'elle pas?

  10. #10
    Expert confirmé Avatar de PauseKawa
    Homme Profil pro
    Technicien Help Desk, maintenance, réseau, système et +
    Inscrit en
    Juin 2006
    Messages
    2 725
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Technicien Help Desk, maintenance, réseau, système et +
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2006
    Messages : 2 725
    Points : 4 005
    Points
    4 005
    Par défaut
    Citation Envoyé par Chris33 Voir le message
    Pourquoi la ligne fen.f2.destroy() ne fonctionne t'elle pas?
    Et comme cela ?

    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
    # python3
    # -*- coding: utf-8 -*-
     
     
     
    from sys import version_info
    if version_info[0] == 2:
        import Tkinter as tkinter
        import ttk as ttk
    else:
        from tkinter import ttk
        import tkinter
    import time, threading
     
    thread_resultat=[]
     
    def treadFini(a):
    	global thread_resultat
    	texte=thread_resultat[0]
    	fen.text1.insert('1.0',texte)
    	fen.f2.geometry("10x10")
    	fen.f2.destroy()
     
    class Monthread (threading.Thread):
        def __init__(self,win,res):
            threading.Thread.__init__(self)
            self.win=win # je mémorise une référence pour la fenêtre
            self.res=res # pour mémoriser le résultat.
    ........
    Sinon, pourquoi un Thread ? Je n'arrive pas à voir l'utilité.

    @+

    Note : Attention a tes indentations. J'ai 8 pour les tiennes (ton éditeur pour tab sans doute).

  11. #11
    Expert confirmé Avatar de PauseKawa
    Homme Profil pro
    Technicien Help Desk, maintenance, réseau, système et +
    Inscrit en
    Juin 2006
    Messages
    2 725
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Technicien Help Desk, maintenance, réseau, système et +
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2006
    Messages : 2 725
    Points : 4 005
    Points
    4 005
    Par défaut
    Oups...

    Citation Envoyé par PauseKawa Voir le message
    Sinon, pourquoi un Thread ? Je n'arrive pas à voir l'utilité.
    Je n'avais pas remarquer que tu parle de trois thread, donc de trois traitements.

    Sinon (et pour en finir avec la question initiale)

    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
    # -*- coding: utf-8 -*-
     
     
     
    from sys import version_info
    if version_info[0] == 2:
        import Tkinter as tkinter
        import ttk as ttk
    else:
        from tkinter import ttk
        import tkinter
    import time, threading
     
    class Centremoi():
        # Pour centrer Tk et Toplevels.
        def __init__(self, monwidget):
            monwidget.update_idletasks()
            monwidget.geometry("%dx%d+%d+%d" % (monwidget.winfo_reqwidth(),monwidget.winfo_reqheight(), (monwidget.winfo_screenwidth()-monwidget.winfo_reqwidth())/2, (monwidget.winfo_screenheight()-monwidget.winfo_reqheight())/2 ) )
            monwidget.resizable(width=False, height=False)
     
    class Monthread (threading.Thread):
        def __init__(self, win):
            threading.Thread.__init__(self)
            self.win=win # je mémorise une référence pour la fenêtre
     
        def run(self):        
            time.sleep(3)
            resultat="toutes mes donnees"
            thread_resultat.append(resultat)
            self.win.event_generate("<<treadFini>>")
     
    class MaFenetre(tkinter.Tk):
        def __init__(self,parent):
            """ fenetre principale"""
            tkinter.Tk.__init__(self, parent)
            self.withdraw()
            self.parent = parent
            #self.protocol("WM_DELETE_WINDOW", self.Intercepte)
            #self.geometry("400x200+200+200")
            self.text1=tkinter.Text(self, width=33)
            self.text1.pack()
            Centremoi(self)
            self.bind("<<treadFini>>", self.treadFini)
            self.deiconify()
            self.ouvrirProgressBar()
            self.lance_thread()
     
        def ouvrirProgressBar(self):
            """ fenetre secondaire (ProgressBarr)"""
            self.f2=tkinter.Toplevel()
            self.f2.withdraw()
            self.f2.transient()
            self.f2.title("fenetre ProgressBar")
            # progressBar :
            self.pbar = ttk.Progressbar(self.f2, mode='indeterminate' ,length=300)
            self.pbar.pack()
            Centremoi(self.f2)
            self.f2.deiconify()
            self.pbar.start()
     
        def lance_thread(self):
            """ Dans le script final, cette méthode lancera 3 threads de cette manière."""
            m=Monthread(self)
            m.start()
     
        def treadFini(self, event=None):
    	texte=thread_resultat[0]
    	self.text1.insert('1.0', texte)
    	self.f2.geometry("10x10") # Pourquoi puisque il y a destroy juste apres ?
            self.f2.destroy()
     
    if __name__=='__main__': 
        fen=MaFenetre(None)
        fen.title("fenetre principale")
        thread_resultat=[]
        fen.mainloop()
    @+

  12. #12
    Membre régulier
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    262
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2005
    Messages : 262
    Points : 93
    Points
    93
    Par défaut
    Merci pour ta réponse.

    Ta classe Centremoi notamment est très intéressante.
    Cependant ce script ne fonctionne pas correctement chez moi et c'est là ma question.

    En fait je vois bien le texte 'toutes mes données' s'afficher,
    mais alors que la ligne:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    self.f2.geometry("10x10")
    qui n'est qu'un test et ne présente aucun intérêt autre fonctionne parfaitement : la fenêtre est réduite,

    la ligne:
    ne fonctionne pas. En fait, self.pbar s'arrête mais mais self.f2 n'est pas détruite.

  13. #13
    Expert confirmé Avatar de PauseKawa
    Homme Profil pro
    Technicien Help Desk, maintenance, réseau, système et +
    Inscrit en
    Juin 2006
    Messages
    2 725
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Technicien Help Desk, maintenance, réseau, système et +
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2006
    Messages : 2 725
    Points : 4 005
    Points
    4 005
    Par défaut
    Bonsoir Chris33,

    Citation Envoyé par Chris33 Voir le message
    Cependant ce script ne fonctionne pas correctement chez moi et c'est là ma question.
    C'est ce qui est dit plus haut (et pour en finir avec la question initiale)
    Ce n'est plus la question.

    A mon avis tu devrais cloturer le sujet 'mettre une toplevel au premier plan' et repartir avec un autre.

    @+

  14. #14
    Expert confirmé Avatar de PauseKawa
    Homme Profil pro
    Technicien Help Desk, maintenance, réseau, système et +
    Inscrit en
    Juin 2006
    Messages
    2 725
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Technicien Help Desk, maintenance, réseau, système et +
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2006
    Messages : 2 725
    Points : 4 005
    Points
    4 005
    Par défaut
    Bonjour,

    Citation Envoyé par Chris33 Voir le message
    ne fonctionne pas. En fait, self.pbar s'arrête mais mais self.f2 n'est pas détruite.
    Utilise tu le code si dessus tel-quel ?

    @+

  15. #15
    Membre régulier
    Profil pro
    Inscrit en
    Septembre 2005
    Messages
    262
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2005
    Messages : 262
    Points : 93
    Points
    93
    Par défaut
    Bonjour et merci à PauseKawa pour son aide.

    Oui, j'utilise le code tel qu'il est (copier-coller). C'est pourquoi je ne comprends pas.
    Quoiqu'il en soit, je vais revoir le problème et en cas de besoin j'ouvrirai effectivement un nouveau sujet.

Discussions similaires

  1. mettre une Toplevel au premier plan.
    Par Luke spywoker dans le forum GTK+ avec Python
    Réponses: 1
    Dernier message: 27/06/2014, 06h17
  2. Comment mettre une fenêtre au premier plan?
    Par damien99 dans le forum MFC
    Réponses: 11
    Dernier message: 30/08/2006, 11h37
  3. Mettre une fenetre au premier plan
    Par madislak dans le forum Interfaces Graphiques en Java
    Réponses: 3
    Dernier message: 14/02/2006, 00h32
  4. Mettre une application en premier plan
    Par portu dans le forum API, COM et SDKs
    Réponses: 15
    Dernier message: 23/02/2005, 15h39
  5. Réponses: 2
    Dernier message: 07/02/2005, 16h43

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