Probleme de variable
Sweety83
Messages postés
17
Date d'inscription
Statut
Membre
Dernière intervention
-
Utilisateur anonyme -
Utilisateur anonyme -
Bonjour,
j'ai un problème concernant les variables et leurs reconnaissances pouvez vous me donner un coup de main svp ?
voici mon programme
code:
from Tkinter import *
M=StringVar
Y=StringVar
D=StringVar
def calculer():
if M>=3:
J=(((23*M)//9)+D+4+Y+(Y//4)-(Y//100)+(Y//400)-2)%7
if M<3:
Z=Y-1
J=(((23*M)//9)+D+4+Y+(Z//4)-(Z//100)+(Z//400))%7
fenetre = Tk()
fenetre.title("connaitre le jour par rapport à une date")
champ_label = Label(fenetre , text="Mois")
champ_label.pack()
M = StringVar
M = Spinbox(fenetre,from_=0,to=12,increment=1,textvariable=M,width=9)
M.pack(padx=10,pady=10)
M = StringVar
champ_label = Label(fenetre , text="Jour")
champ_label.pack(side=LEFT)
D = StringVar
D = Spinbox(fenetre,from_=0,to=31,increment=1,textvariable=D,width=10)
D.pack(side=LEFT, padx=20,pady=10)
D = StringVar
champ_label = Label(fenetre , text="Année")
champ_label.pack(side=RIGHT)
Y = StringVar
Y = Spinbox(fenetre,from_=1582,to=9999,increment=1,textvariable=Y,width=10)
Y.pack(side=RIGHT, padx=30,pady=10)
Y = StringVar
bouton=Button(fenetre, text="calculer", command=calculer)
bouton.pack()
Resultat= StringVar()
Label(fenetre,textvariable=Resultat).pack(padx=30,pady=10)
fenetre.mainloop()
et voici la reponse que cela me donne
code:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python27\lib\lib-tk\Tkinter.py", line 1486, in __call__
return self.func(*args)
File "K:\projet final.py", line 10, in calculer
J=(((23*M)//9)+D+4+Y+(Y//4)-(Y//100)+(Y//400)-2)%7
TypeError: unsupported operand type(s) for *: 'int' and 'classobj'
j'ai un problème concernant les variables et leurs reconnaissances pouvez vous me donner un coup de main svp ?
voici mon programme
code:
from Tkinter import *
M=StringVar
Y=StringVar
D=StringVar
def calculer():
if M>=3:
J=(((23*M)//9)+D+4+Y+(Y//4)-(Y//100)+(Y//400)-2)%7
if M<3:
Z=Y-1
J=(((23*M)//9)+D+4+Y+(Z//4)-(Z//100)+(Z//400))%7
fenetre = Tk()
fenetre.title("connaitre le jour par rapport à une date")
champ_label = Label(fenetre , text="Mois")
champ_label.pack()
M = StringVar
M = Spinbox(fenetre,from_=0,to=12,increment=1,textvariable=M,width=9)
M.pack(padx=10,pady=10)
M = StringVar
champ_label = Label(fenetre , text="Jour")
champ_label.pack(side=LEFT)
D = StringVar
D = Spinbox(fenetre,from_=0,to=31,increment=1,textvariable=D,width=10)
D.pack(side=LEFT, padx=20,pady=10)
D = StringVar
champ_label = Label(fenetre , text="Année")
champ_label.pack(side=RIGHT)
Y = StringVar
Y = Spinbox(fenetre,from_=1582,to=9999,increment=1,textvariable=Y,width=10)
Y.pack(side=RIGHT, padx=30,pady=10)
Y = StringVar
bouton=Button(fenetre, text="calculer", command=calculer)
bouton.pack()
Resultat= StringVar()
Label(fenetre,textvariable=Resultat).pack(padx=30,pady=10)
fenetre.mainloop()
et voici la reponse que cela me donne
code:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Python27\lib\lib-tk\Tkinter.py", line 1486, in __call__
return self.func(*args)
File "K:\projet final.py", line 10, in calculer
J=(((23*M)//9)+D+4+Y+(Y//4)-(Y//100)+(Y//400)-2)%7
TypeError: unsupported operand type(s) for *: 'int' and 'classobj'
A voir également:
- Probleme de variable
- Impossible de créer le fichier de travail. vérifiez la variable d'environnement temp - Forum Microsoft Office
- Variable objet ou variable de bloc with non définie - Forum VB / VBA
- Vba range avec variable ✓ - Forum VB / VBA
- Vérifiez la variable d'environnement TEMP. QUE FAIRE ????? ✓ - Forum Microsoft Office
- Range avec une Variable ✓ - Forum VB / VBA