Vous êtes sur la page 1sur 8

from tkinter.

ttk import *

import sqlite3

from tkinter import*

import tkinter.messagebox

import tkinter.filedialog

from PIL import Image,ImageTk

#fonction ajout

def ajem():

texte= r"E:/projet_python/voiture/vérification_python.txt"

lignes = [] # future liste des lignes

with open(texte, "r", encoding="utf-8") as f:

for ligne in f:

ligne = ligne.rstrip() # supprime la fin de ligne

lignes.append(ligne) # ajoute la ligne à la liste

print(lignes)

global ee1, ee2, ee3, ee4, ee5, ee6, ee7, ee8, ee9, ee10

ee1 = e1.get()

ee2 = e2.get()

ee3 = e3.get()

ee4 = e4.get()

ee5 = e5.get()

ee6 = e6.get()

ee7 = e7.get()

ee8 = e8.get()
ee9 = e9.get()

ee10 = e10.get()

if (ee1 in lignes):

if(ee5==ee6):

conn = sqlite3.connect("E:/projet_python/voiture/voiturelocation")

cur = conn.cursor()

# SQL = ' ' ' INSERT INTO employé(Matricule,Nom,Prénom,Mot de passe,Téléphone,7,8,9,10)


VALUES(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)' ' '

# bb=(ee1,ee2)

SQL = "insert into employé values("

SQL += '"' + ee1 + '"' + "," + '"' + ee2 + '"' + "," + '"' + ee3 + '"' + "," + '"' + ee4 + '"' + "," + '"' + ee5
+ '"' + "," + '"' + ee6 + '"' + "," + '"' + ee7 + '"' + "," + '"' + ee8 + '"' + "," + '"' + ee9 + '"' + "," + '"' + ee10 +
'"' + ')'

cur.execute(SQL)

conn.commit()

cur.close()

conn.close()

else:

tkinter.messagebox.showerror("Erreur", " Le mot de passe saisit différent de la confirmation")

else:

tkinter.messagebox.showerror("Erreur", " Le matricule saisir n'appartient pas à l'entreprise")

#fenetre connexion

def f7():

global fenetre7

fenetre7 = Tk()

fenetre7.geometry("925x500+300+200")

fenetre7.configure(bg='#F4EBEA')
fenetre7.title("Insérer une image")

im1 = Image.open("E:/findacar/DRIVIFY2.png")

photo1 = ImageTk.PhotoImage(im1, master=fenetre7)

fond1 = Label(fenetre7, image=photo1, bg='#F4EBEA')

fond1.place(x=-250, y=0, relwidth=1, relheight=1)

lab = Label(fenetre7, text='Bienvenue !', bg='#F4EBEA', font=('Comic', 30))

lab.place(x=130, y=350)

im2 = Image.open("E:/findacar/bgnuage1.png")

photo2 = ImageTk.PhotoImage(im2, master=fenetre7)

fond2 = Label(fenetre7, image=photo2, bg='#F4EBEA')

fond2.place(x=370, y=0, relwidth=1, relheight=1)

lab1 = Label(fenetre7, text='Bienvenue !', bg='#F4EBEA', font=('Times New Roman', 30))

lab1.place(x=130, y=350)

lab2 = Label(fenetre7, text='Connexion ', bg='#f95d5d', font=("Times New Roman", 40))

lab2.place(x=595, y=45)

var1 = StringVar()

def on_enter(e):

v1.delete(0, 'end')

def on_leave(e):

if v1.get() == '':

v1.insert(0, 'Mail')

v1 = Entry(fenetre7, textvariable=var1, width=40, relief=FLAT, bg="#F4EBEA", borderwidth=0)

v1.insert(0, "Adresse Mail")


v1.bind("<FocusIn>", on_enter)

v1.bind("<FocusOut>", on_leave)

v1.place(x=600, y=180)

Frame(fenetre7, width=250, height=2, bg='black').place(x=595, y=207)

var2 = StringVar()

def on_enter(e):

v2.delete(0, 'end')

def on_leave(e):

if v2.get() == '':

v2.insert(0, 'Mot de passe')

v2 = Entry(fenetre7, textvariable=var2, width=40, relief=FLAT, bg="#F4EBEA", borderwidth=0)

v2.insert(0, "Mot de passe")

v2.bind("<FocusIn>", on_enter)

v2.bind("<FocusOut>", on_leave)

v2.place(x=600, y=250)

Frame(fenetre7, width=250, height=2, bg='black').place(x=595, y=277)

bout1 = Button(fenetre7, text="Se connecter", width=20, height=2, activebackground='#BDF8F6',


font='bold',

bg="#C0C0C0",

bout1.place(x=610, y=350)

bout2 = Button(fenetre7, text='Mot de passe oublié? ', relief='flat', overrelief="flat",


activeforeground='blue',

bg="#f95d5d", fg="black", activebackground='#CAE1FF', font=("bold", 8))

bout2.place(x=670, y=430)

fenetre7.mainloop()

def m1():
global e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,main

main = Tk()

main.geometry("2000x2000")

main.configure(bg='#F4EBEA')

main.title("Insérer une image")

im = Image.open("E:/findacar/3ronduneimage4.png")

photo = ImageTk.PhotoImage(im, master=main)

fond = Label(main, image=photo, bg='#F4EBEA')

fond.place(x=0, y=0, relwidth=1, relheight=1)

im3 = Image.open("E:/findacar/3ronduneimage4.png")

photo3 = ImageTk.PhotoImage(im3, master=main)

fond3 = Label(main, image=photo3, bg='#F4EBEA')

fond3.place(x=0, y=0, relwidth=1, relheight=1)

global log2

titre = Label(main, text='INSCRIPTION', font=("Times New Roman", 30, "bold"), bg='#F4EBEA')

titre.place(x=600, y=100)

nom = Label(main, text='DRIVIFY', font=("Garamond", 40), bg='#F4EBEA')

nom.place(x=560, y=680)

log1 = StringVar()

e1 = Entry(main, textvariable=log1, width=40, relief=FLAT, bg="#F4EBEA", borderwidth=0)

e1.insert(0, "Matricule")

e1.place(x=1100, y=220)

Frame(main, width=250, height=2, bg='black').place(x=1095, y=240)

log2 = StringVar()

e2 = Entry(main, textvariable=log2, width=40, relief=FLAT, bg="#F4EBEA", borderwidth=0)

e2.insert(0, "Nom")

e2.place(x=1100, y=290)
Frame(main, width=100, height=2, bg='black').place(x=1095, y=310)

log3 = StringVar()

e3 = Entry(main, textvariable=log3, width=40, relief=FLAT, bg="#F4EBEA", borderwidth=0)

e3.insert(0, "Prénom")

e3.place(x=1250, y=290)

Frame(main, width=100, height=2, bg='black').place(x=1245, y=310)

log4 = StringVar()

e4 = Entry(main, textvariable=log4, width=40, relief=FLAT, bg="#F4EBEA", borderwidth=0)

e4.insert(0, "Adresse mail")

e4.place(x=1100, y=360)

Frame(main, width=250, height=2, bg='black').place(x=1095, y=380)

log5 = StringVar()

e5 = Entry(main, textvariable=log5, width=40, relief=FLAT, bg="#F4EBEA", borderwidth=0)

e5.insert(0, "Mot de passe")

e5.place(x=1100, y=430)

Frame(main, width=250, height=2, bg='black').place(x=1095, y=450)

log6 = StringVar()

e6 = Entry(main, textvariable=log6, width=40, relief=FLAT, bg="#F4EBEA", borderwidth=0)

e6.insert(0, "Confirmer mot de passe")

e6.place(x=1100, y=500)

Frame(main, width=250, height=2, bg='black').place(x=1095, y=520)

log7 = StringVar()

e7 = Entry(main, textvariable=log7, width=40, relief=FLAT, bg="#F4EBEA", borderwidth=0)

e7.insert(0, "Téléphone")

e7.place(x=1100, y=570)

Frame(main, width=250, height=2, bg='black').place(x=1095, y=590)

l = Label(main, text='Date de naissance', bg="#F4EBEA")

l.place(x=1100, y=600)

log8 = StringVar()

e8 = Entry(main, textvariable=log8, width=40, relief=FLAT, bg="#F4EBEA", borderwidth=0)


e8.insert(0, "Jour")

e8.place(x=1100, y=640)

Frame(main, width=50, height=2, bg='black').place(x=1095, y=660)

log9 = StringVar()

e9 = Entry(main, textvariable=log9, width=40, relief=FLAT, bg="#F4EBEA", borderwidth=0)

e9.insert(0, "Mois")

e9.place(x=1200, y=640)

Frame(main, width=50, height=2, bg='black').place(x=1195, y=660)

log10 = StringVar()

e10 = Entry(main, textvariable=log10, width=40, relief=FLAT, bg="#F4EBEA", borderwidth=0)

e10.insert(0, "Année")

e10.place(x=1300, y=640)

Frame(main, width=50, height=2, bg='black').place(x=1295, y=660)

but4 = Button(main, text="S'inscrire", width=20, height=2, activebackground='#BDF8F6',


font='bold', bg="#C0C0C0",

command=ajem)

but4.place(x=1100, y=690)

but5 = Button(main, text='Déja un compte? Se connecter', relief='flat', overrelief="flat",


activeforeground='blue',

bg="#F4EBEA", fg="red", activebackground='#CAE1FF', font=("arial", 8))

but5.place(x=1150, y=760)

main.mainloop()

def recp():

recup = Tk()

recup.geometry("2000x2000")

recup.configure(bg='#F4EBEA')

recup.title("Insérer une image")


im = Image.open("E:/findacar/recpimage.jpg")

photor = ImageTk.PhotoImage(im, master=recup)

fondr = Label(recup, image=photor, bg='#F4EBEA')

fondr.place(x=0, y=0, relwidth=1, relheight=1)

recup.mainloop()

if __name__ == '__main__':

m1()

f7()

recp()

Vous aimerez peut-être aussi