Python - Tkinter qui ne s'affiche en .exe

Résolu
Courgettedemer Messages postés 7 Date d'inscription   Statut Membre Dernière intervention   -  
Courgettedemer Messages postés 7 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,
J'ai un petit programme petit en tkinter. Je l'ai transformé en exécutable Windows avec pyinstaller, toutes les pages marchent sauf une où les éléments ne s'affichent pas comme ci-dessous.

Exécuté avec python dans le même dossier cela donne ça :

(la date utilise tkcalendar)

Auriez-vous une solution ?
Merci d'avance.

4 réponses

  1. Courgettedemer Messages postés 7 Date d'inscription   Statut Membre Dernière intervention  
     
    Après avoir exécuté mon programme avec une console derrière il me dit :
    Exception in Tkinter callback
    Traceback (most recent call last):
    File "tkinter\__init__.py", line 1921, in __call__
    File "Comptamille.py", line 259, in new
    calendar = DateEntry(toplevel, width=16, bd=2, locale='fr_FR', state='readonly')
    File "tkcalendar\dateentry.py", line 128, in __init__
    File "tkcalendar\calendar_.py", line 258, in __init__
    File "babel\dates.py", line 353, in get_day_names
    File "babel\core.py", line 641, in days
    File "babel\core.py", line 364, in _data
    File "babel\localedata.py", line 141, in load
    File "babel\localedata.py", line 141, in load
    File "babel\localedata.py", line 147, in load
    ModuleNotFoundError: No module named 'babel.numbers'


    On a donc un nouveau problème.
    0
  2. Courgettedemer Messages postés 7 Date d'inscription   Statut Membre Dernière intervention  
     
    Pour ceux qui demandent la fenêtre à afficher est :
        def new(self):
            global userName, debt_dict, users_dict
            def testVal(inStr, acttyp):
                if inStr.replace('.', '', 1).isdigit() or inStr == '':
                    if inStr.startswith('.'):
                        return False
                    return True
                else:
                    return False
    
            def dntwrt(sTr, acttyp):
                return False
    
            toplevel = Toplevel()
            toplevel.title('Comptamille - Nouveau')
            toplevel.geometry('300x300')
            toplevel.iconbitmap('Data\\Image\\icon.ico')
            toplevel.resizable(height=False, width=False)
            calendar = DateEntry(toplevel, width=16, bd=2, locale='fr_FR', state='readonly')
            calendar.place(anchor=CENTER, relx=1/4*3, relwidth=1/4*1.5, rely=1/6*2.5, height=20)
            calendar_l = Label(toplevel,  text='Date :', font=('', 12))
            calendar_l.place(anchor=CENTER, relx=1 / 4 * 3, relwidth=1 / 4 * 1.5, rely=1/6*2.17, height=12)
            amount = Entry(toplevel, bd=0, font=('', 8), validate="key", relief=SOLID, highlightthickness=1)
            amount.config(highlightbackground="#7A7A7A", highlightcolor="#7A7A7A")
            amount['validatecommand'] = (amount.register(testVal), '%P', '%d')
            amount.place(anchor=CENTER, relx=1 / 4 * 1, relwidth=1/4*1.5, rely=1/6*1.5, height=20)
            amount_l = Label(toplevel, text='Total :', font=('', 12))
            amount_l.place(anchor=CENTER, relx=1 / 4 * 1, relwidth=1 / 4 * 1.5, rely=1/6*1.17, height=12)
            users_list = []
            for i in users_dict:
                if i != userName:
                    users_list.append(i)
            user_m = ttk.Combobox(toplevel, values=users_list)
            user_m.place(anchor=CENTER, relx=1 / 4 * 1, relwidth=1/4*1.5, rely=1/6*2.5, height=20)
            #user_m.current(0)
            user_l = Label(toplevel, text='Cible :', font=('', 12))
            user_l.place(anchor=CENTER, relx=1 / 4 * 1, relwidth=1 / 4 * 1.5, rely=1/6*2.17, height=12)
            type_m = ttk.Combobox(toplevel, values=['Crédit', 'Dettes'], state='readonly')
            type_m.place(anchor=CENTER, relx=1 / 4 * 3, relwidth=1 / 4 * 1.5, rely=1 / 6 * 1.5, height=20)
            type_m.current(0)
            type_l = Label(toplevel, text='Transaction :', font=('', 12))
            type_l.place(anchor=CENTER, relx=1 / 4 * 3, relwidth=1 / 4 * 1.5, rely=1 / 6 * 1.17, height=12)
            reason = Text(toplevel, bd=0, font=('', 8), relief=SOLID, highlightthickness=1)
            reason.config(highlightbackground="#7A7A7A", highlightcolor="#7A7A7A")
            reason.place(anchor=CENTER, relx=1 / 4 * 2, relwidth=1 / 4 * 3.5, rely=1 / 6 * 4.2, relheight=1/6*1.75)
            reason_l = Label(toplevel, text='Raison :', font=('', 12))
            reason_l.place(anchor=CENTER, relx=1 / 4 * 2, relwidth=1 / 4 * 1.5, rely=1 / 6 * 3.17, height=12)
    
            def ok():
                global userName
                g_amount = amount.get()
                g_user_m = user_m.get()
                g_reason = reason.get(1.0, "end-1c")
                g_calendar = calendar.get()
                g_type_m = type_m.get()
                if g_type_m == 'Dettes':
                    g_type_m = '-'
                else: g_type_m = '+'
                debt_dict['Debts'][userName].append({'Total': f'{g_amount}', 'Creditor': f'{g_user_m}', 'Reason': f'{g_reason}', 'Date': f'{g_calendar}', 'Type': f'{g_type_m}'})
                self.editlist()
                toplevel.destroy()
    
    
            ok = Button(toplevel, text='OK', font=('', 12), command=ok)
            ok.place(anchor=CENTER, relx=1 / 4 * 2, relwidth=1 / 4 * 3.5, rely=1 / 6 * 5.5, height=20)
    
    0
  3. Courgettedemer Messages postés 7 Date d'inscription   Statut Membre Dernière intervention  
     
    J'ai finalement trouvé ajoutez à votre code
    from babel.dates import format_date, parse_date, get_day_names, get_month_names
    from babel.numbers import * 
    0