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
| from tkinter import *
from tkinter import ttk
from subprocess import call
from tkinter import messagebox
import sqlite3
F_Site=Tk()
F_Site.title("GESTION_LISTE_SITES")
F_Site.geometry("750x600+250+50")
F_Site.resizable(height=False,width=False)
F_Site.configure(bg='gray63')
def creertable_Site():
conn = sqlite3.connect("BD.db")
cur = conn.cursor()
cur.execute("DROP TABLE IF EXISTS tSite")
req = "CREATE TABLE tSite(Id INTEGER PRIMARY KEY AUTOINCREMENT,NomSite text NOT NULL )"
cur.execute(req)
conn.close()
creertable_Site()
def ajouter():
if len(entrsite.get())==0:
messagebox.showinfo("info", "Vous n'avez identifier aucun Site à ajouter....")
else:
conn = sqlite3.connect("BD.db")
cur = conn.cursor()
rq= "INSERT INTO tSite (NomSite) VALUES (?)"
cur.execute(rq,entrsite.get())
entrsite.delete(0, END)
conn.commit()
conn.close()
site=Label(F_Site,text="Nom_Site",font=("arial narow",9,"bold"),bg='gray63',fg="white")
site.place(x='330',y='30')
entrsite=Entry(F_Site,font=("arial narow",8,"bold"),width=55)
entrsite.place(x='400',y='30')
ajout=Button(F_Site,text="Ajouter",font=("arial narow",10,"bold"),width=12,command=ajouter)
ajout.place(x='400',y=60)
F_Site.mainloop() |
Partager