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
|
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Usage: marques.py3
"""
# constantes
__title__ ="Gestion tables marques pour le site"
__author__="Lsa "
__version__="0.0.1"
__purpose__='''
Permet de gérer les marques pour le site.
Pour cela j'utilise mes api.
'''
from tkinter import *
from tkinter import ttk
#from tkinter.ttk import *
import sys
import os
sys.path.append(os.path.__file__)
from mesfonctions import *
def marquefiche():
""" Fiche d'une marque pour la saisie, modification """
framepage = Frame(root, bd=1, relief='solid')
framepage.pack(side="top", fill="both", expand=True)
framepage.grid_columnconfigure(0, weight=0)
framepage.grid_columnconfigure(1, weight=2)
framepage.grid_columnconfigure(2, weight=2)
framepage.grid_columnconfigure(3, weight=0)
frameboutons = Frame(framepage, bd=0, relief='solid')
frameboutons.grid(row=5,column=1,columnspan=4,sticky=E)
#frameboutons.pack(side="bottom", fill="both", expand=True)
labelsep=Label(framepage, text=' ')
labeltitre = Label(framepage, text='Fiche marque', font="arial 20 bold")
labelmarque = Label(framepage, text='Marque :')
chmarque = Entry(framepage)
labelpay = Label(framepage, text='Payorigine :')
chpayorigine = Entry(framepage)
labeltitre.grid(row=0,column=1,columnspan=4,sticky=W+E)
labelmarque.grid(row=1,column=1,sticky=E)
chmarque.grid(row=1,column=2)
labelpay.grid(row=2,column=1,sticky=E)
chpayorigine.grid(row=2,column=2)
boutonvalid = Button(frameboutons, text='Valider', command=root.quit)
boutonquit = Button(frameboutons, text='Quitter', command=root.quit)
boutonvalid.grid(row=0, column=1, sticky=E)
boutonquit.grid(row=0, column=2, sticky=E)
def on_click(e):
x, y = e.x, e.y
print("x, y:", x, y)
def listemarques():
""" Liste de toutes les marques """
framepage = Frame(root, bd=1, relief='solid')
framepage.pack(side="top", fill="both", expand=True)
labeltitre = Label(framepage, text='Liste des marques', font="arial 20 bold")
labeltitre.grid(row=0,column=1,columnspan=7,sticky=W+E)
for x in range(4):
framepage.grid_columnconfigure(x, weight=1)
framepage.grid_columnconfigure(5, weight=3)
framepage.grid_columnconfigure(6, weight=3)
framepage.config(padx='3.0m',pady='3.0m');
entetecolon = ["Id","Marques","Pays","Type","Preparateur","Historique auto","Historique camions"]
for i in range(len(entetecolon)):
Label(framepage, text=entetecolon[i], font="Helvetica 10 bold").grid(row=1, column=i,sticky=W+E)
liste = appelmarque(0)
print(len(liste))
for x in range(len(liste)):
if(x%2 == 0):
coulcar="#000000"
coulfond="#729fcf"
else:
coulcar="#000000"
coulfond="#babdb6"
Label(framepage, text=liste[x]["id"], font="helvetica 8 normal", fg=coulcar, bg=coulfond).grid(row=x+2, column=0,sticky=W+E)
Label(framepage, text=liste[x]["marque"], font="helvetica 8 normal", fg=coulcar, bg=coulfond).grid(row=x+2, column=1,sticky=E+W)
Label(framepage, text=liste[x]["payorigine"], font="helvetica 8 normal", fg=coulcar, bg=coulfond).grid(row=x+2, column=2,sticky=E+W)
Label(framepage, text=liste[x]["type"], font="helvetica 8 normal", fg=coulcar, bg=coulfond).grid(row=x+2, column=3,sticky=E+W)
Label(framepage, text=liste[x]["preparateur"], font="helvetica 8 normal", fg=coulcar, bg=coulfond).grid(row=x+2, column=4,sticky=E+W)
Label(framepage, text=liste[x]["historiqueauto"][:50], font="helvetica 8 normal", fg=coulcar, bg=coulfond).grid(row=x+2, column=5,sticky=E+W)
Label(framepage, text=liste[x]["historiquepl"][:50], font="helvetica 8 normal", fg=coulcar, bg=coulfond).grid(row=x+2, column=6,sticky=E+W)
# labid[0][0].bind('<1>', on_click)
if __name__ == "__main__":
root = Tk()
root.geometry("1200x800")
root.resizable(True, True) # autoriser le redimensionnement vertical 1er true Horizontal 2 true.
root.title(__title__)
# print(api_idclient)
# print(jeton_api)
# marquefiche()
listemarques()
# lancement de la boucle princiaple qui attend les événements
root.mainloop() |
Partager