I'm making a gui for my rfid reader but when i run the program it only operates on the shell window and does not open a tkinter gui window. I'm kind of new with python and it's gui so can anybody help me. even a tutorial for a solution to my problem can help. here is my code. thank you for the help.
from tkinter import *
import binascii
import socket
import time
import signal
import sys
import Adafruit_PN532 as PN532
root = Tk(className="Team Baboy")
root.geometry("800x480")
welcome = Label(root,text="Welcome to Hog Traceability System")
welcome.pack()
welcome.config(font=("Gothic", 18))
back = Frame(width=800, height=480)
back.pack()
instruction = Label(master=back, text='Tap your Authorization Card')
instruction.pack()
instruction.config(font=("Gothic", 30))
instruction.grid(row=0, column=1, padx=0, pady=150)
CS = 18
MOSI = 23
MISO = 24
SCLK = 25
CARD_KEY = [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]
Delay = 1
HEADER = b'BG'
def close(signal, frame):
sys.exit(0)
signal.signal(signal.SIGINT, close)
pn532 = PN532.PN532(cs=CS, sclk=SCLK, mosi=MOSI, miso=MISO)
pn532.begin()
pn532.SAM_configuration()
print('PN532 NFC RFID 13.56MHz Card Reader')
while True:
uid = pn532.read_passive_target()
if uid is None:
continue
print('')
print('Card UID 0x{0}'.format(binascii.hexlify(uid)))
if not pn532.mifare_classic_authenticate_block(uid, 4, PN532.MIFARE_CMD_AUTH_B, CARD_KEY):
print('Failed to authenticate with card!')
continue
data = pn532.mifare_classic_read_block(4)
if data is None:
print('Failed to read data from card!')
continue
if data[0:2] != HEADER:
print('Card is not written with proper block data!')
continue
print('User Id: {0}'.format(int(data[2:8].decode("utf-8"), 16)))
root.mainloop()