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 :

Erreur "ValueError: invalid literal for int() with base 10"


Sujet :

Tkinter Python

  1. #1
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Novembre 2019
    Messages
    2
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 23
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Novembre 2019
    Messages : 2
    Points : 3
    Points
    3
    Par défaut Erreur "ValueError: invalid literal for int() with base 10"
    Bonjour j'ai un probleme avec ce code lorsque je lance la fonction choice en elle meme ell fonctionne cependant lorsqu'elle est appelée dans la fonction prtphase cela me marque le message d'erreur suivant :
    << File "C:\Users\Elie\Desktop\projet2.0.py", line 232, in prtphase
    choice()
    File "C:\Users\Elie\Desktop\projet2.0.py", line 214, in choice
    X=int(x.get())
    ValueError: invalid literal for int() with base 10: '' >>

    Voici le dit programme :

    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
    def choice():
        choix = tki.Tk()  
        x = tki.StringVar()  
        z = tki.StringVar()  
        xz = tki.StringVar()
        Title = tki.Label(choix, text="Selon quels axes voulez vous les courbes ? ")
        Title.pack()
        chkbtn1 = tki.Checkbutton(choix, text = "X", variable = x, onvalue=1, offvalue=0)
        chkbtn1.deselect()
        chkbtn1.pack()
        chkbtn2 = tki.Checkbutton(choix, text = "Z", variable = z, onvalue=1, offvalue=0)
        chkbtn2.deselect()
        chkbtn2.pack()
        chkbtn3 = tki.Checkbutton(choix, text = "X et Z", variable = xz, onvalue=1, offvalue=0)  
        chkbtn3.deselect()
        chkbtn3.pack()
        bouton_entree = tki.Button(choix, text="Entrée", command = choix.destroy )
        bouton_entree.pack()
        choix.mainloop()
        X=int(x.get())
        Z=int(z.get())
        XZ=int(xz.get())
     
    def prtphase(t, Lx, Lz):
        tv = []
        vX, vZ = deriv(Lx, t), deriv(Lz, t)
        aX, aZ = deriv(vX, t), deriv(vZ, t)
        xadapt, zadapt, vxadapt, vzadapt = [], [], [], []
        for i in range(1,len(t)-1):
            tv.append(t[i])
        for i in range (1,len(Lx)-1):
            xadapt.append(Lx[i])
            zadapt.append(Lz[i])
        for i in range (1,len(vX)-1):
            vxadapt.append(vX[i])
            vzadapt.append(vZ[i])
            choice()
    Comment faire ?
    Merci beaucoup pour votre aide.

  2. #2
    Expert éminent sénior
    Homme Profil pro
    Architecte technique retraité
    Inscrit en
    Juin 2008
    Messages
    21 287
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Manche (Basse Normandie)

    Informations professionnelles :
    Activité : Architecte technique retraité
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2008
    Messages : 21 287
    Points : 36 781
    Points
    36 781
    Par défaut
    Salut,

    Citation Envoyé par Eode06 Voir le message
    Comment faire ?
    à la 2ème ligne remplacez choix = tki.Tk() par choix = tki.Toplevel().
    Et revoyez la différence entre fenêtre principale, secondaire, frame,...

    - W
    Architectures post-modernes.
    Python sur DVP c'est aussi des FAQs, des cours et tutoriels

Discussions similaires

  1. [Python 3.X] ValueError: invalid literal for int() with base 10: 'RM 2'
    Par Nordier dans le forum Général Python
    Réponses: 3
    Dernier message: 30/08/2019, 09h45
  2. invalid literal for int() with base 10: ''
    Par Mini-minimoys dans le forum Général Python
    Réponses: 4
    Dernier message: 21/01/2016, 11h08
  3. [V8] ValueError: invalid literal for int() with base 10
    Par chagala dans le forum Odoo (ex-OpenERP)
    Réponses: 2
    Dernier message: 28/05/2015, 09h27
  4. [Débutant] invalid literal for int() with base 10: '\r'
    Par oodini dans le forum Général Python
    Réponses: 19
    Dernier message: 23/03/2011, 15h25
  5. invalid literal for int() with base 10:
    Par EricStib dans le forum Général Python
    Réponses: 9
    Dernier message: 05/01/2009, 13h22

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