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
|
from Tkinter import *
from datetime import datetime
import nxppy
import time
import polling
mifare = nxppy.Mifare()
while True:
try:
if mifare is None:
mifare.poll(lambda: mifare.select(), step=0.5, poll_forever=True)
if mifare is not None:
uid = mifare.select()
uiddecimal = int(uid, 16)
datetime = time.strftime('%d/%m/%y %H:%M',time.localtime())
print uiddecimal
except nxppy.SelectError:
pass
class Application:
def __init__(self, master):
frame = Frame(master)
frame.pack()
Label(frame, text="Numero de badge : ").grid(row=0, column=0)
Label(frame, text=uiddecimal).grid(row=0, column=1)
Label(frame, text="Date et heure d'arriver : ").grid(row=1, column=0)
Label(frame, text=datetime).grid(row=1, column=1)
Label(frame, text="Nom de l'agent : ").grid(row=2, column=0)
Label(frame, text="").grid(row=2, column=1)
Label(frame, text="Prise de service : ").grid(row=3, column=0)
saisir = StringVar()
saisir.set("")
saisie = Entry(frame, text=saisir, width=50).grid(row=4, column=0)
prise_service = saisir.get()
Button(frame, text='Envoyer', command="").grid(row=5, column=1, padx=5, pady=50)
Button(frame, text='Quitter', command=quit).grid(row=5, column=0, padx=5, pady=50)
root = Tk()
root.wm_title('Lecteur badge')
root.geometry("500x300")
app = Application(root)
root.mainloop() |