Can someone please help me troubleshoot this problem.
I have a top level window that asks a user to scan a RFID card and asks how long to activate the card for. Problem is, the window displays the buttons but they can not be pressed until the called function scanCardLoop has return a value. This is a problem as the close window button, and the window 'x' button can not be activated:
I have a top level window that asks a user to scan a RFID card and asks how long to activate the card for. Problem is, the window displays the buttons but they can not be pressed until the called function scanCardLoop has return a value. This is a problem as the close window button, and the window 'x' button can not be activated:
def activateCard(): #Instantiate a Toplevel window activateCardWindow = Toplevel() TopLevelWindow(activateCardWindow, 300, 300, "Activate Card") label = Label(activateCardWindow, text="Scan to activate:", height=0, width=100) label.pack(side='top') #Entry box for the returned value of the RFID card scancard = Entry(activateCardWindow) scancard.pack(side = TOP) #Buttons requesting how long to activate for hourBtn = Button(activateCardWindow, text="1 hour", width=20) halfDayBtn = Button(activateCardWindow, text="Half day", width=20) allDayBtn = Button(activateCardWindow, text="All day", width=20) allDayBtn.pack(side='bottom', pady=5) halfDayBtn.pack(side='bottom') hourBtn.pack(side='bottom', pady=5) #For some reason this update has to be called otherwise the calling root window will not load this window activateCardWindow.update() #Call the scanCardLoop and place the returned value into tagID tagID = scanCardLoop() #Please tagID into entry box scancard.insert(END, tagID) def scanCardLoop(): waitingForScan = True while waitingForScan == True: # Scan for cards (status,TagType) = MIFAREReader.MFRC522_Request(MIFAREReader.PICC_REQIDL) # If a card is found #if status == MIFAREReader.MI_OK: #print("Card detected") # Get the UID of the card (status,uid) = MIFAREReader.MFRC522_Anticoll() # If we have the UID, continue if status == MIFAREReader.MI_OK: # Store tag ID #global rftagID rftagID.set("%s,%s,%s,%s" % (uid[0], uid[1], uid[2], uid[3])) # Print UID print("Card read UID: %s,%s,%s,%s" % (uid[0], uid[1], uid[2], uid[3])) waitingForScan = False return rftagID.get()I suspect that there is some update issue going on.