Changement de type de variable
Fermé
Sweety83
Messages postés
17
Date d'inscription
jeudi 16 avril 2015
Statut
Membre
Dernière intervention
15 mai 2015
-
9 mai 2015 à 20:18
dsy73 Messages postés 9252 Date d'inscription dimanche 22 août 2010 Statut Contributeur Dernière intervention 23 octobre 2020 - 15 mai 2015 à 21:06
dsy73 Messages postés 9252 Date d'inscription dimanche 22 août 2010 Statut Contributeur Dernière intervention 23 octobre 2020 - 15 mai 2015 à 21:06
A voir également:
- Changer le type d'une variable python
- Changer dns - Guide
- Changer clavier qwerty en azerty - Guide
- Changer le type de fichier - Guide
- Changer carte graphique - Guide
- Citizen code python - Accueil - Outils
1 réponse
dsy73
Messages postés
9252
Date d'inscription
dimanche 22 août 2010
Statut
Contributeur
Dernière intervention
23 octobre 2020
2 483
10 mai 2015 à 06:53
10 mai 2015 à 06:53
Salut
tu devrais mettre le code concerné (avec coloration syntaxique).
Pour la conversion de type : https://fr.wikiversity.org/wiki/Python/Les_types_de_base
tu devrais mettre le code concerné (avec coloration syntaxique).
Pour la conversion de type : https://fr.wikiversity.org/wiki/Python/Les_types_de_base
Modifié par Sweety83 le 10/05/2015 à 17:47
code:
from Tkinter import *
from tkMessageBox import *
fenetre = Tk()
fenetre.title("connaitre le jour par rapport à une date")
def calculer():
if D>31 and M==1:
showwarning("attention","date non valide\nLe jour ne convient pas")
elif D>31 and M==3:
showwarning("attention","date non valide\nLe jour ne convient pas")
elif D>31 and M==5:
showwarning("attention","date non valide\nLe jour ne convient pas")
elif D>31 and M==7:
showwarning("attention","date non valide\nLe jour ne convient pas")
elif D>31 and M==8:
showwarning("attention","date non valide\nLe jour ne convient pas")
elif D>31 and M==10:
showwarning("attention","date non valide\nLe jour ne convient pas")
elif D>31 and M==12:
showwarning("attention","date non valide\nLe jour ne convient pas")
elif D>30 and M==4:
showwarning("attention","date non valide\nLe jour ne convient pas")
elif D>30 and M==6:
showwarning("attention","date non valide\nLe jour ne convient pas")
elif D>30 and M==9:
showwarning("attention","date non valide\nLe jour ne convient pas")
elif D>30 and M==11:
showwarning("attention","date non valide\nLe jour ne convient pas")
elif D>29 and M==2:
showwarning("attention","date non valide\nLe jour ne convient pas")
elif M>12 :
showwarning("attention","date non valide\nLe mois ne convient pas")
elif Y%4!=0 and D==29 and M==2:
showwarning("attention","date non valide\nL'année n'est pas bisextile")
elif Y%4==0 and Y%100==0 and Y%400!=0 and D==29 and M==2:
showwarning("attention","date non valide\nL'année n'est pas bisextile")
else:
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
if J==0:
showinfo("date","le ",D/1,"/",M/1,"/",Y/1," est un dimanche")
if J==1:
showinfo("date","le ",D/1,"/",M/1,"/",Y/1," est un lundi")
if J==2:
showinfo("date","le ",D/1,"/",M/1,"/",Y/1," est un mardi")
if J==3:
showinfo("date","le ",D/1,"/",M/1,"/",Y/1," est un mercredi")
if J==4:
showinfo("date","le ",D/1,"/",M/1,"/",Y/1," est un jeudi")
if J==5:
showinfo("date","le ",D/1,"/",M/1,"/",Y/1," est un vendredi")
if J==6:
showinfo("date","le ",D/1,"/",M/1,"/",Y/1," est un samedi")
D=IntVar()
Champ = Entry(fenetre, textvariable=D,bg='black', fg='white')
Champ.focus_set()
Champ.pack(side = LEFT, padx = 5, pady = 5)
M=IntVar()
Champ = Entry(fenetre, textvariable=M,bg='black', fg='white')
Champ.focus_set()
Champ.pack(side = LEFT, padx = 5, pady = 5)
Y=IntVar()
Champ = Entry(fenetre, textvariable=Y,bg='black', fg='white')
Champ.focus_set()
Champ.pack(side = LEFT, padx = 5, pady = 5)
bouton=Button(fenetre, text="calculer", command=calculer)
bouton.pack()
fenetre.mainloop()
ou faut-il que je rajoute la transformation pour qu'elle ai lieu correctement et que le programme puisse s'effectuer ?
10 mai 2015 à 17:29
10 mai 2015 à 17:47
10 mai 2015 à 19:14
10 mai 2015 à 19:34
comme sa c'est mieux ?