def loadProcessedImage(frame):
    # tell users to make google vision call or place an item based on the satus of the image
    global app
    renderingUtil.refresh(app.frames[frame].instruction)
    try:
        tryOpen = Image.open(workingDir + objectImg)
        app.frames[frame].instruction = tk.Label(
            app.frames[frame],
            text="Your item is ready to be scanned",
            font=('helvetica', 15))
    except OSError:
        print('cannot open')
        app.frames[frame].instruction = tk.Label(
            app.frames[frame],
            text="Please place an item in front of the camera",
            font=('helvetica', 15))
    app.frames[frame].instruction.pack()

    # update the image when a new image is generated and cropped
    renderingUtil.refresh(app.frames[frame].promptLabel)
    readImg = renderingUtil.resizeImage(objectImg)
    app.frames[frame].img = ImageTk.PhotoImage(readImg)
    app.frames[frame].promptLabel = tk.Label(app.frames[frame],
                                             image=app.frames[frame].img)
    app.frames[frame].promptLabel.pack()
 def loginAsGuest(self):
     renderingUtil.refresh(self.loginStatus)
     self.loginStatus = tk.Label(self, text="You have successfully loged in as guest", height = 2, font=('helvetica', 15))
     self.loginStatus.pack()
     renderingUtil.refresh(self.continue_button)
     self.continue_button = tk.Button(self, text="Continue", height = 2, font=('helvetica', 15), command= lambda: self.continueToLanding())
     self.continue_button.pack()
 def printIntersection(self, warning, matchingArr):
     renderingUtil.refresh(self.alert)
     # tried to scan non-existent words
     if matchingArr == "notOCR":
         self.alert = tk.Label(self,
                               text="No ingredients text detected",
                               font=('helvetica', 15))
         self.alert.pack()
         return
     # item does not exist as a custom item. Prompted to scan printed ingredients
     if matchingArr == "notRecognition":
         self.alert = tk.Label(
             self,
             text=
             "Not recognized as a store custom item. Maybe try regular item instead?",
             font=('helvetica', 15))
         self.alert.pack()
         return
     # no match: no harmful ingredients
     if not matchingArr:
         self.alert = tk.Label(self,
                               text="No harmful ingredients detected",
                               font=('helvetica', 15))
         self.alert.pack()
     # found harmful ingredients
     else:
         warning = "We found the following " + warning + " that you might not want: \n "
         for element in matchingArr:
             warning += element + ", "
         warning = warning[:-2]
         self.alert = tk.Label(self, text=warning, font=('helvetica', 15))
         self.alert.pack()
 def continueToLanding(self):
     self.controllor.show_frame(LandingPage)
     renderingUtil.refresh(self.loginStatus)
     self.loginStatus = tk.Label(self,
                                 text="Please log in to continue",
                                 height=2,
                                 font=('helvetica', 15))
     self.loginStatus.pack()
     renderingUtil.refresh(self.continue_button)
 def loginBT(self):
     textInput = "Browsing for a bluetooth login.... "
     renderingUtil.refresh(self.loginStatus)
     self.loginStatus = tk.Label(self,
                                 text=textInput,
                                 height=2,
                                 font=('helvetica', 15))
     self.loginStatus.pack()
     renderingUtil.refresh(self.continue_button)
def bluetoothLogin(frame, customerId):
    global app
    renderingUtil.refresh(app.frames[frame].loginStatus)
    textInput = "you have successfully loged in as " + customerId
    app.frames[frame].loginStatus = tk.Label(app.frames[frame], text=textInput, height = 2, font=('helvetica', 15))
    app.frames[frame].loginStatus.pack()
    renderingUtil.refresh(app.frames[frame].continue_button)
    app.frames[frame].continue_button = tk.Button(app.frames[frame], text="Continue", height = 2, font=('helvetica', 15), command= lambda: app.frames[frame].continueToLanding())
    app.frames[frame].continue_button.pack()
    def show_plist(self, context, controller):
        URL = "http://52.138.39.36:3000/plist"
        userName = '******'
        PARAMS = {'username': '******'}
        response = requests.post(url=URL, json=PARAMS)
        resJson = response.json()
        userList = []

        renderingUtil.refresh(self.user_list)
        for element in resJson['message']:
            userList.append(element["p"])
        str1 = ""
        for element in userList:
            str1 += element.lower()
            str1 += " "
        self.user_list = tk.Label(controller.frames[context], text='Here is your list: ' + str1, font=('helvetica', 15))
        self.user_list.pack(padx=10, pady=10)
 def backToHomePage(self, controller):
     for i in self.itemList:
         if i != None:
             renderingUtil.refresh(i)
     for j in self.ingredientsList:
         if j != None:
             renderingUtil.refresh(j)
     renderingUtil.refresh(self.subcanvas)
     renderingUtil.refresh(self.alert)
     controller.show_frame(LandingPage)