×

Créé une application python qui gère des inscription (Tkinter)

Créé une application python qui gère des inscription (Tkinter)

Dans cette vidéo on vas crée une application python qui gère des inscription. On va utiliser la librairie Tkinter de python pour l’interface graphique et mysql pour gerer notre base de donné avec wampserver et phpMyadmin

Le code du programme est composer comme suit :

  • Le fichier accueil.py qui présente un formulaire d’ajout des information de la personne.
from tkinter import *
from tkinter.filedialog import askopenfilename
from tkinter.messagebox import showerror,showinfo
from listedesinscrit import listeInscrit

class Personnage():
  def __init__(self, prenom, nom, photo):
    self.prenom = prenom
    self.nom = nom
    self.photo = photo

  def __eq__(self, other):
    return (self.prenom==other.prenom and self.nom==other.nom)


def parcourir():
  global imageName
  imn=askopenfilename(initialdir = "/",title = "Selectionner une photo",
    filetypes = (("png files","*.png"),("jpeg files","*.jpg")))
  if imn:
    imageName=imn
  if imageName:
    texte = imageName.split('/')
    photoEntre.configure(text='.../'+texte[-1])

def appartient(liste,val):
    for i in range(len(liste)):
      if liste[i].__eq__(val):
        return 1
    return 0

def valider():
  global listePersonne,imageName
  photo = imageName
  if prenomEntre.get() and nomEntre.get() and photo:
    pn = Personnage(prenomEntre.get(),nomEntre.get(),photo)
    if appartient(listePersonne,pn):
      showerror(title="Erreur sur le formulaire",message="Cet utilisateur existe deja !")
    else:
      listePersonne.append(pn)
      showinfo(title="validation reussie",message=prenomEntre.get()+" "+nomEntre.get()+" a bien été ajouter.")
  else:
    showerror(title="Erreur sur le formulaire",message="Voyez renseigner tout les chants du formulaire !")


def reinitialiser():
  global imageName
  prenomEntre.delete(0, END)
  nomEntre.delete(0, END)
  imageName=''
  photoEntre.configure(text="aucune selection")

imageName,listePersonne = '',[]

fen = Tk()
fen.geometry("300x320+300+150")
fen.title("Page d'inscription")
contenu = Canvas(fen,bg='#FF7800')

fontLabel = 'arial 13 bold'
fontEntre = 'arial 10 bold'

prenom = Label(contenu, text="Votre prenom :",font=fontLabel,fg='white',bg='#FF7800')
nom = Label(contenu, text="Votre nom :",font=fontLabel,fg='white',bg='#FF7800')
photo = Label(contenu, text="Votre photo :",font=fontLabel,fg='white',bg='#FF7800')
validation = Label(contenu,text="Entrer vos informations ici",font=fontLabel,fg='#FF7800',bg='white')

prenomEntre = Entry(contenu, font=fontEntre)
nomEntre = Entry(contenu, font=fontEntre)
photoEntre = Label(contenu, font='arial 8 bold',text="aucune selection",bg='#FF7800',fg='white')
buttonParcourir = Button(contenu,text="Pr",command=parcourir,font=fontLabel,fg='#FF7800',bg='white')

validation.grid(row=0,column=0,columnspan=2)
prenom.grid(row=1,column=0,sticky=E,padx=5,pady=5)
prenomEntre.grid(row=1,column=1,padx=5,pady=5)
nom.grid(row=2,column=0,sticky=E,padx=5,pady=5)
nomEntre.grid(row=2,column=1,padx=5,pady=5)
photo.grid(row=3,column=0,sticky=E,padx=5,pady=5)
photoEntre.grid(row=3,column=1,padx=5,pady=5,sticky=W)
buttonParcourir.grid(row=3,column=1,padx=5,pady=5,sticky=E)


b1 = Button(fen,text="Validé ",command=valider,width=10,font=fontLabel,bg='#FF7800',fg='white')
b2 = Button(fen,text="Renitialiser ",command=reinitialiser,width=10,font=fontLabel,bg='#FF7800',fg='white')
b3 = Button(fen,text="Voir la liste ",command=lambda: listeInscrit(fen,listePersonne),width=10,font=fontLabel,bg='#FF7800',fg='white')

b1.grid(row=4,column=0,pady=5)
b2.grid(row=5,column=0,pady=5)
b3.grid(row=6,column=0,pady=5)

contenu.grid(row=0,column=0,padx=5,pady=5)

fen.mainloop()

  • Le fichier listeInscrit.py qui comme son nom l’indique, présente la liste des personne qui sont sur la base de donné.
from tkinter import *
from PIL import Image,ImageTk

def listeInscrit(fenetre,liste):
  newFen = Toplevel(fenetre)
  newFen.title("Liste des inscrits")
  newFen.geometry("350x400+350+150")
  listeCan = Canvas(newFen,bg='#FF7800')
  fontLabel='arial 11 bold'

  resultat = Label(listeCan,text="Liste des gens inscrits",font=fontLabel,fg='#FF7800',bg='white')
  prenom = Label(listeCan, text="Prenom",width=15,font=fontLabel,fg='white',bg='#FF7800')
  nom = Label(listeCan, text="Nom",width=6,font=fontLabel,fg='white',bg='#FF7800')
  photo = Label(listeCan, text="Photo",width=12,font=fontLabel,fg='white',bg='#FF7800')
  status = Label(newFen,text="Aucun inscrit pour le moment",font='arial 9 bold',fg='white',bg='#FF7800')

  listeCan.grid(row=0,column=0)
  resultat.grid(row=0,column=0,columnspan=3)
  photo.grid(row=1,column=0,padx=5,pady=5)
  prenom.grid(row=1,column=1,padx=5,pady=5)
  nom.grid(row=1,column=2,padx=5,pady=5)
  status.grid(row=2,column=0,columnspan=3)

  if liste:
    r=2
    for p in liste:
      photoLab = Label(listeCan,bg='white',height=50)
      img = Image.open(p.photo)
      img = img.resize((80,80),Image.ANTIALIAS)
      photoLab.img = ImageTk.PhotoImage(img)
      photoLab.configure(image=photoLab.img)
      pre = Label(listeCan, text=p.prenom,font=fontLabel,fg='white',bg='#FF7800')
      no = Label(listeCan, text=p.nom,font=fontLabel,fg='white',bg='#FF7800')
      photoLab.grid(row=r,column=0,pady=2)
      pre.grid(row=r,column=1)
      no.grid(row=r,column=2)
      listeCan.create_line(9,55,335,55,width=1,fill='white')
      r+=1
    status.configure(text="{} inscrits pour le moment".format(len(liste)))
    status.grid(row=r,column=0,columnspan=3,pady=2)

  newFen.mainloop()

La vidéo complète du tuto est déjà sur ma chaine YouTube. je vous invite a allez le visualiser pour mieux comprendre le code et le réutiliser. Merci.

Vidéo YouTube.

87 commentaires

Avatar
Hozizs

allergy medications for itching skin otc allergy medication comparison chart allergy pills for rash

Avatar
Ghoeru

best medicine in stomach pain bactrim drug

Avatar
Bknddr

isotretinoin 10mg cost accutane 20mg uk buy generic isotretinoin online

Avatar
Vfjxti

amoxicillin 500mg without prescription amoxicillin 500mg cheap oral amoxicillin

Avatar
Urldpz

strong sleeping pills boots pill meloset 3mg

Avatar
Rpcbpx

order azithromycin 500mg generic azithromycin cheap azithromycin buy online

Avatar
Qlzwok

order neurontin generic neurontin 600mg usa

Avatar
Dwjkyx

oral azithromycin 250mg purchase azipro for sale azithromycin 500mg canada

Avatar
Ebaufi

lasix 100mg ca buy lasix 40mg pill

Avatar
Mmvxjg

order prednisolone pills order omnacortil 20mg buy prednisolone 40mg online cheap

Avatar
Dfleui

buy amoxil 250mg generic amoxicillin pill amoxil order online

Avatar
Xpriwj

order doxycycline 200mg pills vibra-tabs order online

Avatar
Szfdbc

buy ventolin for sale antihistamine pills over the counter albuterol buy online

Avatar
Wlpvqg

purchase amoxiclav pills buy augmentin sale

Avatar
Dmodcx

buy vardenafil 10mg without prescription buy vardenafil 20mg online cheap

Avatar
Qcqwyl

buy generic clomid 50mg order clomiphene 100mg online serophene tablet

Avatar
Myvvus

brand zanaflex tizanidine online order generic tizanidine 2mg

Avatar
Fkmfcl

generic rybelsus 14 mg semaglutide 14mg generic order generic semaglutide 14mg

Avatar
Luhyng

brand deltasone 40mg deltasone 40mg brand prednisone 5mg over the counter

Avatar
Cmsdvw

buy rybelsus cheap cheap rybelsus 14mg order rybelsus 14 mg generic

Avatar
Gzyvcu

order isotretinoin 20mg how to get isotretinoin without a prescription accutane 20mg sale

Avatar
Zbzstp

albuterol inhalator ca cost albuterol inhalator buy albuterol without prescription

Avatar
Oehemz

cheap amoxil 250mg order amoxil 250mg buy generic amoxicillin over the counter

Avatar
Xhleaw

augmentin us buy augmentin 375mg generic buy augmentin medication

Avatar
Gozniw

order azithromycin 250mg online zithromax order online zithromax 500mg cheap

Avatar
Hmcmsj

purchase levoxyl online buy synthroid online buy synthroid 150mcg pill

Avatar
Kqlksk

prednisolone 40mg over the counter buy omnacortil for sale prednisolone cost

Avatar
Kfnnza

order clomid 50mg pills order clomiphene 50mg pill buy cheap clomiphene

Avatar
Vdifci

neurontin 600mg without prescription gabapentin ca neurontin 800mg us

Avatar
Oicufz

order sildenafil 100mg sildenafil 50mg pills for men us viagra sales

Avatar
Pbksja

lasix canada cost furosemide 100mg furosemide 40mg cost

Avatar
Eaksbf

semaglutide generic semaglutide online buy order semaglutide online cheap

Avatar
Pqvham

purchase doxycycline pill monodox cost buy doxycycline generic

Avatar
Lqjooc

casino slot casino free spin free online roulette

Avatar
Ibzkmf

levitra 10mg over the counter buy levitra 10mg generic buy vardenafil 20mg pills

Avatar
Dxtvmm

pregabalin 75mg without prescription buy lyrica 150mg without prescription order generic lyrica

Avatar
Bizowv

plaquenil 400mg brand hydroxychloroquine 400mg oral order hydroxychloroquine 400mg

Avatar
Dkqfkh

order aristocort online order aristocort 4mg generic purchase triamcinolone online cheap

Avatar
Zaiujr

tadalafil 10mg over the counter tadalafil brand cialis 10mg ca

Avatar
Boutros-Toni

Mon ordinateur me met une erreur quand je rentre cette ligne « from listedesinscrit import listeInscrit ».
Que faire?

Avatar
Ejgevd

order desloratadine 5mg without prescription desloratadine 5mg without prescription order desloratadine 5mg without prescription

Avatar
Mxozqi

cenforce 50mg cheap order cenforce 100mg for sale buy cenforce 50mg online

Avatar
Ndolgk

cheap research papers for sale help write my paper essay writing assistance

Avatar
Qvnlzz

inderal 10mg ca inderal over the counter buy plavix without a prescription

Avatar
Cpyryz

methotrexate 10mg brand cost methotrexate cost medex

Avatar
Qhkjbg

meloxicam 15mg tablet order meloxicam 7.5mg pill buy generic celecoxib 200mg

Avatar
Eolurv

reglan drug buy cozaar no prescription order losartan 25mg pill

Avatar
Anpssf

buy tamsulosin online cheap order tamsulosin online celebrex generic

Avatar
Ceyrdf

esomeprazole 40mg over the counter buy esomeprazole 20mg sale topamax online buy

Avatar
Atscqj

ondansetron ca aldactone usa order spironolactone pills

Avatar
Pagpul

sumatriptan 25mg us purchase imitrex pills levofloxacin pills

Avatar
Pbrnvv

buy simvastatin 10mg generic zocor 10mg how to get valtrex without a prescription

Avatar
Vrsbym

dutasteride online buy dutasteride medication order zantac 150mg online

Avatar
Twfgey

oral finpecia diflucan 200mg tablet where can i buy forcan

Avatar
Vbsgdp

buy generic ampicillin for sale buy cheap penicillin buy amoxil no prescription

Avatar
Acnaop

cipro oral – purchase amoxiclav generic order augmentin 375mg sale

Avatar
Zwjzar

generic ciprofloxacin – order myambutol buy clavulanate pills

Avatar
Mlsfeb

flagyl pills – cefaclor 250mg ca cheap azithromycin 250mg

Avatar
Erppvb

buy cheap generic ciprofloxacin – buy chloramphenicol generic erythromycin 500mg ca

Avatar
Erdfnz

valtrex tablet – generic diltiazem order zovirax 800mg sale

Avatar
Bkhvvp

stromectol 6mg online – cheap ceftin 250mg buy tetracycline generic

Avatar
Xdjmmn

flagyl over the counter – buy metronidazole 200mg pill buy zithromax 500mg pill

Avatar
Ilxojg

cheap acillin cheap amoxicillin generic amoxil tablets

Avatar
Cklwgr

order generic lasix 40mg – buy prazosin no prescription buy capoten tablets

Avatar
tlovertonet

Thank you for sharing excellent informations. Your web-site is so cool. I’m impressed by the details that you have on this web site. It reveals how nicely you understand this subject. Bookmarked this website page, will come back for more articles. You, my pal, ROCK! I found just the info I already searched everywhere and simply couldn’t come across. What a great website.

Avatar
Cgoabx

metformin 1000mg uk – how to get lincocin without a prescription lincomycin 500mg for sale

Avatar
Nyrsbu

buy zidovudine 300 mg pills – order irbesartan 150mg pills allopurinol 300mg without prescription

Avatar
Бонус за регистрацию в binance

Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?

Avatar
Plzxne

clozapine 50mg tablet – purchase altace pills famotidine 40mg for sale

Avatar
Bewufo

quetiapine 50mg sale – venlafaxine us order eskalith online

Avatar
Erotxv

order clomipramine 50mg sale – purchase asendin online cheap order doxepin generic

Avatar
Ahbtlg

order atarax 25mg generic – purchase prozac online cheap buy endep cheap

Avatar
Vnsgql

amoxil for sale online – erythromycin 250mg tablet order ciprofloxacin 1000mg sale

Avatar
Dackud

clavulanate brand – zyvox 600mg usa generic ciprofloxacin 500mg

Avatar
Tcapre

buy clindamycin online – buy oxytetracycline purchase chloromycetin online

Avatar
Huugew

buy azithromycin no prescription – buy ofloxacin online generic ciplox 500mg

Avatar
Wzdepd

ivermectin without a doctor prescription – order doxycycline for sale cefaclor 250mg brand

Avatar
Cployi

order albuterol 2mg – order seroflo brand theophylline 400mg

Avatar
Cruslr

desloratadine tablet – flixotide brand purchase ventolin sale

Avatar
Daftar

Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?

Avatar
Vukhat

methylprednisolone 4 mg tablet – claritin drug purchase astelin for sale

Avatar
Wcqhaa

order micronase 2.5mg for sale – forxiga without prescription buy dapagliflozin 10mg

Avatar
Jhbmge

buy prandin online cheap – cheap prandin order jardiance 25mg without prescription

Avatar
Ennyrt

purchase glucophage pills – glucophage 1000mg cheap purchase acarbose pills

Avatar
Kqmvdp

lamisil cost – order fluconazole 200mg generic grifulvin v buy online

Avatar
Pearyt

oral famvir 500mg – acyclovir 400mg sale valaciclovir 500mg uk

Avatar
Sqjufc

order lanoxin for sale – irbesartan over the counter buy lasix online cheap diuretic

Laisser un commentaire