Bonjour,
maintenant je créé une fenêtre de type Toplevel elle s'ouvre bien, mais rien ne s'affiche et j'ai beau relire le code, mais je ne vois pas ce qui pêche.
Auriez-vous la gentillesse de me remettre sur la piste.
Merci beaucoup à tous par avance. Le python c'est complexe mais super puissant...

dans mon module varfunction s'y trouve ces imports :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
 
from tkinter import *
import tkinter as tk
import tkinter.ttk as ttk
from tkinter import font
from PIL import Image, ImageTk # module image
from tkinter.scrolledtext import * 
import sqlite3
import webbrowser
Donc mon main.py

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
# -*- coding: utf-8 -*-
from varfunction import *
from tpl_auteur import *
 
def set_frame():
 
    #================== Création de la fenêtre principale ================
    fenetre_pce =tk.Tk() # Fenêtre prinicpale
    fenetre_pce.title("Menesis... se souvenir !")
    screen_x = int(fenetre_pce.winfo_screenwidth())   # Fonction centrer fenêtre
    screen_y = int(fenetre_pce.winfo_screenheight())
    fenetre_pce_x = 1260
    fenetre_pce_y = 768
    pos_x = (screen_x // 2) - (fenetre_pce_x // 2)
    pos_y = (screen_y // 2) - (fenetre_pce_y // 2)
    geo = "{}x{}+{}+{}".format(fenetre_pce_x, fenetre_pce_y, pos_x, pos_y)   
    fenetre_pce.geometry(geo)
    fenetre_pce.resizable(width=True,height=True) 
    fenetre_pce.iconbitmap("img/search.ico") 
    return fenetre_pce # ne pas oublier de retourner 
 
if __name__ == '__main__':
    mainframe = set_frame()
 
    #=================== Création d'un menu ==============================
    menubar = Menu(mainframe,borderwidth=20, relief=GROOVE) # Création de la FRAME 
    menuFichier = Menu(menubar, tearoff=0) 
    menubar.add_cascade(label="Fichier", menu=menuFichier) 
    menuFichier.add_command(label="Créer")
    menuFichier.add_command(label="Ouvrir",)
    menuFichier.add_command(label="Editer")
    menuFichier.add_separator() 
    menuFichier.add_command(label="Quitter",command=mainframe.quit)
 
    menuEdition = Menu(menubar, tearoff=0)
    menubar.add_cascade(label="Edition", menu=menuEdition)
    menuEdition.add_command(label="Couper")
    menuEdition.add_command(label="Copier")
    menuEdition.add_command(label="Coller")
    menuEdition.add_command(label="Créer")
 
    menuAuteur = Menu(menubar, tearoff=0)
    menubar.add_cascade(label="Auteur", menu=menuAuteur)
    menuAuteur.add_command(label="Créer", command=write_auteur)
    menuAuteur.add_command(label="Consulter")
 
    menuCitation = Menu(menubar, tearoff=0)
    menubar.add_cascade(label="Citation", menu=menuCitation)
    #menuCitation.add_command(label="Créer", command=write_citation)
    #menuCitation.add_command(label="Consulter", command=result_citation)
 
    menuLien = Menu(menubar, tearoff=0)
    menubar.add_cascade(label="jw.org", menu=menuLien)
    menuLien.add_command(label="Jw", command=open_jw_org)
    menuLien.add_command(label="Bibliothèque", command=open_jw_wol)
 
    menuAide = Menu(menubar, tearoff=0)
    menubar.add_cascade(label="Aide", menu=menuAide)
    menuAide.add_command(label="A propos") 
 
    mainframe.config(menu=menubar) # Configuration et print menu
    #----------------------------------------------------------------
 
    #Citation accueil
    lblcitation = Label(mainframe, text=" Recherches et connaissance", font=("Arial", 14,"bold"))
    lblcitation.pack()
 
    # Fond d'écram accueil
    frontimage = ImageTk.PhotoImage(Image.open("img/connaissance_1260-720.jpg") ) # image de fond page d'accueil
    frontimagelabel = Label(mainframe, image=frontimage)
    frontimagelabel.pack(expand=1)  
 
    #== Fermeture de la boucle principale ==
    mainframe.mainloop() # Boucle principale
et mon Toplevel tpl_auteur.py

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
# -*- coding: utf-8 -*-
from varfunction import *
 
def write_auteur():
    """ Saisie des auteurs """
    tpl_auteur = tk.Toplevel()  #== Contructeur Toplevel ==
    tpl_auteur.title(" Bienvenue dans la saisie des auteurs")
    screen_x = int(tpl_auteur.winfo_screenwidth())
    screen_y = int(tpl_auteur.winfo_screenheight())
    tpl_auteur_x = 1024
    tpl_auteur_y = 600
    pos_x = (screen_x // 2) - (tpl_auteur_x // 2)
    pos_y = (screen_y // 2) - (tpl_auteur_y // 2)
    geo = "{}x{}+{}+{}".format(tpl_auteur_x, tpl_auteur_y, pos_x, pos_y)
    tpl_auteur.geometry(geo)
    tpl_auteur.resizable(width=False,height=False) # Fen�tre modifiable True or False
    tpl_auteur.iconbitmap("img/search.ico") ### Changement de l'icone de la fen�tre [l'icone doit �tre plac� dans le r�pertoire racine de l'application ou un autre r�pertoire img/...]
    tpl_auteur.configure(bg='Gray79')    
    return tpl_auteur
 
if __name__ == '__main__':
    main_tpl = write_auteur()
 
 
    labelAuteur = Label(main_tpl, text="Auteur",bg='Gray79', font=("Arial", 12,"bold"))
    labelAuteur.place(x=30,y=38)
    entreeAuteur = Entry (main_tpl, width="50",font=("Century Gothic", 14,"bold"))
    entreeAuteur.place(x=30,y=65)
    labelInfo = Label(main_tpl, text="Information",bg='Gray79', font=("Arial", 12,"bold"))
    labelInfo.place(x=30,y=100)
    entreeInfo = Text(main_tpl, width="106", height="18",font=("Century Gothic", 12))
    entreeInfo.place(x=30,y=127)
    boutonEnregistrer = Button(main_tpl, text='Enregistrer', activebackground="SkyBlue1", 
                               command=lambda : save_auteur(entreeAuteur.get(), entreeInfo.get('1.0', END)))  
    boutonEnregistrer.pack(side=BOTTOM, anchor=SE, padx=20, pady=20) #boutonEnregistrer.place(x=700,y=400)  
 
    #== Fermeture de la boucle principale ==
    main_tpl.mainloop() # Boucle principale