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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126
|
import tkinter
import os
from tkinter import*
from PIL import Image, ImageDraw, ImageFont
from tkcalendar import DateEntry
from tkinter import END
import tkinter.filedialog
# Fenetre principale
Matequip = Tk()
Matequip.title("Matequip")
Matequip.iconbitmap("logo1.ico")
Matequip.geometry("800x600")
Matequip.maxsize(600, 500)
# Menu deroulant1
cofreco170D = os.listdir(dossier où récupérer les images)
cofreco170 = tkinter.Listbox(Matequip, width=25)
cofreco170.bind('<<ListboxSelect>>')
cofreco170.place(x=400, y=20)
lselec = tkinter.Label(Matequip)
lselec.place(x=300, y=300)
for file in cofreco170D:
cofreco170.insert(END, file)
# Choix de marque
# choix de marque
check = tkinter.Checkbutton(Matequip, text="Noe")
check.place(x=300, y=20)
check1 = tkinter.Checkbutton(Matequip, text="Cofreco")
check1.place(x=400, y=20)
# Texte pour client
titre = Label(Matequip, text="Client :")
titre.place(x=0, y=10)
myEntry = tkinter.Entry(Matequip, width=30)
myEntry.place(x=60, y=10)
# Texte pour chantier
titre1 = Label(Matequip, text="Chantier :")
titre1.place(x=0, y=50)
myEntry1 = tkinter.Entry(Matequip, width=30)
myEntry1.place(x=60, y=50)
# Texte pour N°client
titre2 = Label(Matequip, text="N°Client :")
titre2.place(x=0, y=100)
myEntry2 = tkinter.Entry(Matequip, width=30)
myEntry2.place(x=60, y=100)
# Texte pour N°Affaire
titre3 = Label(Matequip, text="N°Affaire :")
titre3.place(x=0, y=150)
myEntry3 = tkinter.Entry(Matequip, width=30)
myEntry3.place(x=60, y=150)
# Interlocuteur
titre4 = Label(Matequip, text="Interlocuteur :")
titre4.place(x=0, y=200)
myEntry4 = tkinter.Entry(Matequip, width=30)
myEntry4.place(x=85, y=200)
# Date
dateauto = DateEntry(Matequip, selectmode='day', date_pattern='dd/MM/yyyy')
dateauto.place(x=110, y=250)
titre5 = Label(Matequip, text="Date d'aujourd'hui :")
titre5.place(x=0, y=250)
# Seconde fenetre
def ecritsurimage():
CLIENT = myEntry.get()
chantier = myEntry1.get()
numClient = myEntry2.get()
numaffaire = myEntry3.get()
personne = myEntry4.get()
date = dateauto.get()
choix = PhotoImage(cofreco170)
font = ImageFont.truetype('arial.ttf', 25)
img = Image.open(choix)
draw = ImageDraw.Draw(img)
draw.text((1630, 2970), (f"{CLIENT}"), (0, 153, 204), font=font)
draw.text((1890, 2980), (f"{chantier}"), (0, 153, 204), font=font)
draw.text((1835, 2902), (f"{numClient}"), (0, 153, 204), font=font)
draw.text((2165, 2902), (f"{numaffaire}"), (0, 153, 204), font=font)
draw.text((2195, 2980), (f"{personne}"), (0, 153, 204), font=font)
draw.text((650, 2868), (f"{date}"), (0, 153, 204), font=font)
fichier = [('All File', '*.*'),
('PDF File', '*.pdf')]
fichiers = asksaveasfile(filetypes=fichier, defaultextension=fichier)
Bouton8 = tkinter.Button(Matequip, height=1, width=30, text=" Modifier le fichier selectionner ",command=ecritsurimage)
Bouton8.place(x=60, y=400)
Matequip.mainloop() |
Partager