def starttimelapse2(): no = 1 global tbp global running global picture global button global r global g global b global brightness print('Time Lapse Has Started!') ## cam.start_preview() sleep(2) cam.capture("warmup.jpg") endbutton.enable() button.disable() previewbutton.disable() if os.path.exists("/home/pi/photos/" + filename_choice.value): print("folder exits") #appwarning = Window(app, title="Warning") filenameexists = yesno("Filename already exists!", "Would you like to overwrite?") if filenameexists == True: pass else: finishtimelapse() #app.display() else: os.makedirs("/home/pi/photos/" + filename_choice.value) print("made folder") while running: picture.hide() set_motes() sleep(0.5) filename = "/home/pi/photos/" + str(filename_choice.value) + "/" + str( filename_choice.value) + str(no).zfill(4) + (".jpg") filename_choice.disable() cam.iso = 100 sleep(2) cam.shutter_speed = cam.exposure_speed cam.exposure_mode = 'off' g = cam.awb_gains cam.awb_mode = 'off' cam.awb_gains = g cam.capture(filename) print(tbp) print('Captured %s' % filename) im = Image.open(filename) im.thumbnail((240, 180), Image.ANTIALIAS) im.save('arse.png') picture = Picture(app, image="arse.png", grid=[0, 4]) picture.height = 180 picture.width = 240 picture.show() messagercounter = Text(app, text=str(no), grid=[0, 3]) no = no + 1 sleep(0.1) mote.clear() mote.show() sleep(tbp)
def previewstart(): global picture picture.hide() cam.capture("preview.jpg") im = Image.open("preview.jpg") im.thumbnail((240, 180), Image.ANTIALIAS) im.save('arse.png') picture = Picture(app, image="arse.png", grid=[0, 4]) picture.height = 180 picture.width = 240 picture.show()
def TwoPlayer(): global suit1 global suit2 global suit3 global suit4 global isGameAddition global addedScoresPlayerOne global addedScoresPlayerTwo suit1 = random.randint(0, 3); suit2 = random.randint(0, 3); # print("First suit1 is " + str(suit1)); print("Second suit2 is " + str(suit2)) suit3 = random.randint(0, 3); suit4 = random.randint(0, 3) # print("Third suit3 is " + str(suit3)); print("Fourth suit4 is " + str(suit4)) cardNumber1, suit1 = RandomCard(suit1); cardNumber2, suit2 = RandomCard(suit2) # print("first card is " + str(cardNumber1)); print("second card is " + str(cardNumber2)) # print("CardnNumber1 suit number is " + str(suit1)); print("CardNumber2 suit number is " + str(suit2)) cardNumber3, suit3 = RandomCard(suit3); cardNumber4, suit4 = RandomCard(suit4) # print("third card is " + str(cardNumber3)); print("fourth card is " + str(cardNumber4)) # print("CardnNumber3 suit number is " + str(suit3)); print("CardNumber4 suit number is " + str(suit4)) if (isGameAddition == True): addedScoresPlayerOne = cardNumber1 + cardNumber2 addedScoresPlayerTwo = cardNumber3 + cardNumber4 elif (isGameAddition != True): addedScoresPlayerOne = cardNumber1 - cardNumber2 addedScoresPlayerTwo = cardNumber3 - cardNumber4 #print(addedScoresPlayerOne); print(addedScoresPlayerTwo) cardImage1 = Picture(cardImagesTwoPlayer1, image="PlayingCards/" + str(cardList[suit1][0]) + "/" + str(cardNumber1) + ".png", grid=[0, 0]) cardImage1.width = 144; cardImage1.height = 192 cardImage2 = Picture(cardImagesTwoPlayer1, image="PlayingCards/" + str(cardList[suit2][0]) + "/" + str(cardNumber2) + ".png", grid=[1, 0]) cardImage2.width = 144; cardImage2.height = 192 cardImage3 = Picture(cardImagesTwoPlayer2, image="PlayingCards/" + str(cardList[suit3][0]) + "/" + str(cardNumber3) + ".png", grid=[3, 0]) cardImage3.width = 144; cardImage3.height = 192 cardImage4 = Picture(cardImagesTwoPlayer2, image="PlayingCards/" + str(cardList[suit4][0]) + "/" + str(cardNumber4) + ".png", grid=[4, 0]) cardImage4.width = 144; cardImage4.height = 192
def OnePlayer(): global suit1 global suit2 global isGameAddition global addedScoresPlayerOne suit1 = random.randint(0, 3); suit2 = random.randint(0, 3) # print("First suit is " + str(suit1)); print("Second suit is " + str(suit2)) cardNumber1, suit1 = RandomCard(suit1); cardNumber2, suit2 = RandomCard(suit2) # print("first card is " + str(cardNumber1)); print("second card is " + str(cardNumber2)) # print("CardnNumber1 suit number is " + str(suit1)); print("CardNumber2 suit number is " + str(suit2)) if (isGameAddition == True): addedScoresPlayerOne = cardNumber1 + cardNumber2 elif (isGameAddition != True): addedScoresPlayerOne = cardNumber1 - cardNumber2 # print(addedScoresPlayerOne) cardImage1 = Picture(cardImagesOnePlayer, image="PlayingCards/" + str(cardList[suit1][0]) + "/" + str(cardNumber1) + ".png", grid=[0, 0]) cardImage1.width = 144; cardImage1.height = 192 cardImage2 = Picture(cardImagesOnePlayer, image="PlayingCards/" + str(cardList[suit2][0]) + "/" + str(cardNumber2) + ".png", grid=[1, 0]) cardImage2.width = 144; cardImage2.height = 192
def test_getters_setters(): a = App() p = Picture(a) assert p.image == None p.image = "../examples/guizero.gif" assert p.image == "../examples/guizero.gif" assert p._image.tk_image is not None p.width = 100 assert p.width == 100 p.height = 100 assert p.height == 100 a.destroy()
def showBoard(): global board, tileButtonDict, tileList, gameBoard, difficulty createGame(difficulty) rowLabelCount = 0 columnLabelCount = 0 if len(tileList) > 256: rowLength = int(len(tileList)/16) else: rowLength = math.sqrt(len(tileList)) rowCount = 0 columnCount = 0 for tile in tileList: if not tile.isMined: surroundingMines = Text(board, text=str(tile.surroundingMineCount), grid=[columnCount,rowCount]) surroundingMines.height = 2 surroundingMines.width = 3 textDict[tile.label] = surroundingMines else: picture = Picture(board, image='bomb2.jpg', grid=[columnCount,rowCount]) picture.height = 25 picture.width = 15 mineDict[tile.label] = picture tileButton = PushButton(board, command=playGame, image = 'blank.jpg' , args=[tile], grid=[columnCount,rowCount], text='')#str(tile)#.isMined))#str(tile)) tileButton.bg = 'gray60' #print ('button grid', tileButton.grid) tileButton.when_right_button_pressed = markTile tileButton.width = 32 tileButton.height = 37 tileButtonDict[tile.label] = tileButton columnCount += 1 if columnCount == rowLength: rowCount += 1 columnCount = 0
# Widgets menubar = MenuBar(app, toplevel=["File", "Edit"], options=[ [ ["Today's Report", todays_report], [today.strftime("%Y Report"), yearly_report],\ ["Recent Reports", white_card_folder]], [ ["Today's List", open_window]] ]) title = Text(app, "Yard Crew", color="White", size=30, font="Quicksand Medium") tech = Combo(app, options=techCombo + ["Tech"], selected="Tech" , command=writeTech) tech.text_size = 30 tech.bg = "white" spacer = Box(app, width="fill", height=20) pic = Picture(app, image=str(main_image)) pic.width = 460 pic.height = 345 spacer2 = Box(app, width="fill", height=30) close = PushButton(app, text="Exit", command=close_app) # Second Window: Edit Today's List window = Window(app, title = "Edit Today's List", height=500, width=950, layout="grid") window.hide() lspacer = Box(window, grid=[0,0], width=20, height=500) left_box = Box(window, grid=[1,0]) mspacer = Box(window, grid=[2,0], width=40, height=500) right_box = Box(window, grid=[3,0]) rspacer = Box(window, grid=[4,0], width=20, height=500) # LeftBox
grid=[0, 2]) brightnessslider = Slider(app, grid=[1, 1], end="255", command=bright) brightnessslider.width = 150 button = PushButton(app, command=thread_starting, text="Start", grid=[1, 3]) button.bg = 'green' endbutton = PushButton(app, command=finishtimelapse, text="End", grid=[3, 3]) endbutton.bg = 'red' filename_choice = TextBox(app, text="Filename", grid=[1, 4]) picture = Picture(app, image="arse.png", grid=[0, 4]) picture.height = 180 picture.width = 240 colour = Combo(app, options=["white", "green", "red", "blue", "yellow", "pink"], selected="white", grid=[2, 1], command=set_motes) previewbutton = PushButton(app, text="Preview", command=previewstart, grid=[2, 3]) endbutton.disable() app.display()
def __init__(self, app): Window.__init__(self, app, title="Scanner", layout="grid") self.tk.attributes("-fullscreen", True) self.hide() # Components Text(self, text="Scanner", grid=[0, 0, 3, 1]) Text(self, text="Empty", grid=[0, 1]) p1 = Picture(self, image="data/empty.jpg", grid=[0, 2]) p1.height = 194 p1.width = 259 def update_empty(): database.save_empty() p1.value = "data/empty.jpg" PushButton(self, command=update_empty, text="Retake Empty", grid=[0, 7]) Text(self, text="Scan", grid=[1, 1, 2, 1]) p2 = Picture(self, image="data/testpic.jpg", grid=[1, 2]) p2.height = 194 p2.width = 259 p3 = Picture(self, image="data/testscan.jpg", grid=[2, 2]) p3.height = 135 p3.width = 184 m1 = Text(self, text="Card:", grid=[1, 6]) def update_scan(): global last_scan out = scanner.scan_card(img=last_scan) last_scan = out[0] if out[1] is not None: if len(out[1]) > 0: cv2.drawContours(last_scan, out[1], -1, (0, 255, 0), 2) if out[2] is not None: cv2.drawContours(last_scan, [out[2]], -1, (255, 0, 0), 2) cv2.imwrite("data/testpic.jpg", last_scan) p2.value = "data/testpic.jpg" if out[3] is not None: cv2.imwrite("data/testscan.jpg", out[3]) p3.value = "data/testscan.jpg" card = database.get_card(out[3]) if card is None: m1.value = "Card: Not Found" else: m1.value = "Card: " + card.name def update_lower(): scanner.lower = s1.value update_scan() s1 = Slider(self, command=update_lower, start=0, end=255, grid=[1, 3]) s1.value = scanner.lower s1.width = 259 def update_upper(): scanner.upper = s2.value update_scan() s2 = Slider(self, command=update_upper, start=0, end=255, grid=[2, 3]) s2.value = scanner.upper s2.width = 259 def update_width_min(): scanner.width_min = s3.value update_scan() s3 = Slider(self, command=update_width_min, start=0, end=1500, grid=[1, 4]) s3.value = scanner.width_min s3.width = 259 def update_width_max(): scanner.width_max = s4.value update_scan() s4 = Slider(self, command=update_width_max, start=0, end=1500, grid=[2, 4]) s4.value = scanner.width_max s4.width = 259 def update_height_min(): scanner.height_min = s5.value update_scan() s5 = Slider(self, command=update_height_min, start=0, end=1500, grid=[1, 5]) s5.value = scanner.height_min s5.width = 259 def test_scanner(): out = scanner.scan_card() global last_scan last_scan = out[0] if out[1] is not None: if len(out[1]) > 0: cv2.drawContours(last_scan, out[1], -1, (0, 255, 0), 2) if out[2] is not None: cv2.drawContours(last_scan, [out[2]], -1, (255, 0, 0), 2) cv2.imwrite("data/testpic.jpg", last_scan) p2.value = "data/testpic.jpg" if out[3] is not None: cv2.imwrite("data/testscan.jpg", out[3]) p3.value = "data/testscan.jpg" card = database.get_card(out[3]) if card is None: m1.value = "Card: Not Found" else: m1.value = "Card: " + card.name PushButton(self, command=test_scanner, text="Scan", grid=[1, 7]) def close_scanner(): self.hide() PushButton(self, command=close_scanner, text="Exit", grid=[0, 8, 2, 1])
text=">", grid=[1, 0]) raw_button = PushButton(button_box, command=go_to_page, args=[-1], text="Ingredients", grid=[2, 0]) ## Drink Buttons mojito_box = Box(page_one, grid=[0, 1], align="top", layout="grid") mojito_image = Picture(mojito_box, grid=[0, 0], align="top", image="mojito.jpeg") mojito_image.height = image_size mojito_image.width = image_size mojito_button = PushButton(mojito_box, grid=[0, 1], text="Mojito", command=make_mojito) marg_box = Box(page_one, grid=[1, 1], align="top", layout="grid") marg_image = Picture(marg_box, grid=[0, 0], align="top", image="strawberryMarg.jpg") marg_image.height = image_size marg_image.width = image_size strawberry_marg_button = PushButton(marg_box, grid=[0, 1], command=make_strawberry_marg,
app.after(TimepoError,bg_grey) return False else: Text_Response.value=e.reason app.bg="#FFFF00" space1.bg="#FFFF00" space1.text_color="#FFFF00" app.after(TimepoError,bg_grey) return False app = App(title="Sebas",height=420,width=480,layout="grid",bg="gray") #app = App(title="Sebas",height=420,width=480) space1 = Text(app, text="aaaaaaa", size=20, grid=[0,0],color="gray",bg="gray") logo = Picture(app, image=image_path, grid=[1,0]) logo.height=250 logo.width=250 space2 = Text(app, text="", size=10, grid=[1,1]) Text_Response = Text(app, text="", size=28, grid=[1,2], font="Times New Roman", color="black") space3 = Text(app, text="", size=10, grid=[1,3]) BARCODE = TextBox(app, height=64, width=36, grid=[1,4]) BARCODE.focus() BARCODE.tk.bind('<Key-Return>', ScanBarcode) app.display()
##### <<<<<<<<< SETUP GPIO PINS FOR BUBBLES >>>>>>>>> ##### GPIO.setmode(GPIO.BCM) GPIO.setwarnings(False) GPIO.setup(gpio_pin, GPIO.OUT) GPIO.output(gpio_pin, GPIO.HIGH) ##### <<<<<<<<< CONFIGURE GUI >>>>>>>>> ##### # Header Section playback_app = App(title="Playback App", bg=(255, 255, 255), layout='grid') user_window = Window(playback_app, title="User", layout='grid') isvrlogo = Picture(user_window, image="isvrlogo.jpg", grid=[0, 0, 2, 1]) isvrlogo.height = 50 isvrlogo.width = 150 spacer = Text(user_window, text=" ", size=30, grid=[0, 1, 1, 1]) # annotation = Text(user_window,text="Bubble Demo",size=30,grid=[2,0,2,1]) spacer = Text(user_window, text=" ", size=30, grid=[2, 0, 2, 1]) spacer = Text(user_window, text=" ", size=30, grid=[4, 1, 1, 1]) uoslogo = Picture(user_window, image="uoslogo.jpg", grid=[4, 0], align='right') # uoslogo = PushButton(user_window, command=open_admin,image="uoslogo.jpg",grid=[4,0],align='right') uoslogo.height = 50 uoslogo.width = 167 uoslogo.when_clicked = open_admin # Main Section play_button = PushButton(user_window, command=push_play, text="Tone On", grid=[1, 1, 2, 1],
picture.cancel( nextFrame ) # necessary so that a click will advance the frame, but cancel the previously scheduled advance currentFrame = currentFrame + 1 picture.value = home_path + str( currentFrame) + config['SplashScreen']['imageFile'] picture.after( int(config['SplashScreen']['animateSecondsPerFrame']) * 1000, nextFrame) currentFrame = 1 picture = Picture(splashApp, image=home_path + str(currentFrame) + config['SplashScreen']['imageFile']) # scale the picture so its the same as the app picture.width = splashApp.width picture.height = splashApp.height timer = picture.after( int(config['SplashScreen']['animateSecondsPerFrame']) * 1000, nextFrame) # kick off the animation splashApp.when_key_pressed = onKeyPress splashApp.when_clicked = onClick splashApp.display() #### IDE Launch #### # Take the starter file and move it into place, overwriting the file that's there: shutil.copyfile( home_path + config['Activity']['starterFile'], config['Activity']['newFileLocation'] + config['Activity']['newFileName'])
def LiveCollection(cycles): printedData = [] liveTime = [] liveTemp = [] liveHumid = [] livePress = [] liveWindow = Window(app, title="Data Collection Window", layout="grid") liveWindow.width = 620 liveWindow.height = 920 try: localCycles = int(cycles) except: print("invalid variable") liveWindow.error("Error", "Invalid Variable") else: x = 0 localCycles = int(cycles) liveDataList = ListBox(liveWindow) imageContainer = Box(liveWindow, layout="grid", grid=[1, 0], align="top", border=True) imageContainer.border = 10 liveTempImage = Picture(imageContainer) liveHumidImage = Picture(imageContainer) livePressImage = Picture(imageContainer) while x < (localCycles): currentTemperature = (round(sense.get_temperature(), 2)) currentHumidity = round(sense.get_humidity(), 2) currentPressure = round(sense.get_pressure(), 2) currentTime = time.strftime("%H%M%S", time.localtime()) currentDate = time.strftime("%Y%m%d", gmtime()) ID = str(currentTime) + str(currentDate) liveTime.append(currentTime) liveTemp.append(currentTemperature) liveHumid.append(currentHumidity) livePress.append(currentPressure) printedData.append(("ID:", ID)) printedData.append(("Temp:", currentTemperature)) printedData.append(("Humidity:", currentHumidity)) printedData.append(("Pressure:", currentPressure)) printedData.append(("Time:", currentTime)) printedData.append(("Date:", currentDate)) printedData.append( ("Entry: {0} Out of: {1}".format(x + 1, localCycles))) printedData.append("") connection.execute( "INSERT INTO WeatherData (ID, Temp, Humid, Press, Time, Date) Values ({0}, {1}, {2}, {3}, {4}, {5});" .format(ID, currentTemperature, currentHumidity, currentPressure, currentTime, currentDate)) connection.commit() plt.clf() plt.plot(liveTime, liveTemp) plt.ylabel("Temperature") plt.xlabel("Time") plt.savefig("liveTemp.png") plt.clf() plt.plot(liveTime, liveHumid) plt.ylabel("Pressure") plt.xlabel("Time") plt.savefig("liveHumid.png") plt.clf() plt.plot(liveTime, livePress) plt.ylabel("Humidity") plt.xlabel("Time") plt.savefig("livePress.png") plt.clf() liveDataList.destroy() liveDataList = ListBox(liveWindow, items=printedData, grid=[0, 0], scrollbar=True) liveDataList.width = 200 liveDataList.height = 920 liveTempImage.destroy() liveTempImage = Picture(imageContainer, image="liveTemp.png", grid=[0, 0]) liveTempImage.width = 400 liveTempImage.height = 300 liveHumidImage.destroy() liveHumidImage = Picture(imageContainer, image="liveHumid.png", grid=[0, 1]) liveHumidImage.width = 400 liveHumidImage.height = 300 livePressImage.destroy() livePressImage = Picture(imageContainer, image="livePress.png", grid=[0, 2]) livePressImage.width = 400 livePressImage.height = 300 liveWindow.update() time.sleep(10) x += 1 liveWindow.focus()
text.width = 30 text.height = 2 text_box = TextBox(app, "some text") text_box.width = 50 slider = Slider(app) slider.width = 300 slider.height = 30 button = PushButton(app) button.width = 20 button.height = 2 pic = Picture(app, image="guizero.gif") pic.width = 400 pic.height = 50 combo = Combo(app, ["martin", "laura", "rik"]) combo.width = 50 combo.height = 2 check = CheckBox(app, "tick me") check.width = 17 check.height = 2 button_group = ButtonGroup(app, ["cheese", "onion", "crisps"], 1) button_group.width = 35 button_group.height = 9 button_group.bg = "darkgrey"
from guizero import App, Picture, PushButton, info app = App() anim = Picture(app, "guizero_flash.gif") anim.width = 200 anim.height = 100 button = PushButton(app, command=info, args=["button", "you pushed the image"], image="guizero_flash.gif") button.width = 200 button.height = 100 app.display()
temp_led.bg = 'red' ph_led.bg = 'red' dox_led.bg = 'red' temp_led.disable() ph_led.disable() dox_led.disable() divider2 = Text(box, text="", grid=[1, 5]) divider2.width = 10 divider2.font = 'Source code pro' values_tag = Text(box, text="Sensor Values", grid=[1, 6]) values_tag.size = 10 values_tag.font = 'Source code pro' temp_server = Text(box, text='', grid=[1, 7]) ph_server = Text(box, text='', grid=[2, 7]) dox_server = Text(box, text='', grid=[3, 7]) divider3 = Text(box, text="", grid=[1, 8]) divider3.width = 10 divider3.font = 'Source code pro' picture = Picture(app, image="logo.jpeg", grid=[2, 9]) picture.width = 75 picture.height = 75 app.repeat(1000, read_sensors) # Schedule call to counter() every 1000ms app.display()
from guizero import App, PushButton, Text, Box, Window, Picture app = App(height=1000, width=1000) board1 = Box(app, height=50, width=50) board1.tk.grid = [0,0] board1.bg = 'red' board2 = Box(app, height=50, width=50) board2.bg = 'blue' board2.tk.grid = [1,2] board3 = Box(app, height=50, width=50) board3.tk.grid = [1,1] board3.bg = 'green' board3 = Box(app, height=50, width=50) board3.bg = 'yellow' board4 = Box(app, height=50, width=50) board4.tk.grid = [1,3] picture = Picture(board4, image='lose2.jpg') picture.height = 50 picture.width = 50 #board3.bg = 'green' #picture = Picture(app, image='lose2.jpg', grid=[0,0]) #picture = Picture(app, image='lose2.jpg', grid=[0,2, 10, 3]) app.display()
def __init__(self, app, cd): Window.__init__(self, app, title="Scanner", layout="grid") CD = cd self.tk.attributes("-fullscreen", True) self.hide() # Scanner page title Text(self, text="Scanner", grid=[0, 0, 3, 1]) # Empty column 0 Text(self, text="Empty", grid=[0, 1]) p1 = Picture(self, image="data/empty.jpg", grid=[0, 2]) p1.height = 194 p1.width = 259 def update_empty(): cd.save_empty() p1.value = "data/empty.jpg" PushButton(self, command=update_empty, text="Retake Empty", grid=[0, 7]) # Scan columns 1 & 2 Text(self, text="Scan", grid=[1, 1, 2, 1]) p2 = Picture(self, image="data/testpic.jpg", grid=[1, 2]) p2.height = 194 p2.width = 259 p3 = Picture(self, image="data/testscan.jpg", grid=[2, 2]) p3.height = 135 p3.width = 184 m1 = Text(self, text="Card: Tragic Arrogance", grid=[1, 3, 2, 1]) # Scan parameter sliders def update_width_min(): scanner.width_min = s1.value s1 = Slider(self, command=update_width_min, start=0, end=1500, grid=[1, 4, 2, 1]) s1.value = scanner.width_min def update_width_max(): scanner.width_max = s2.value s2 = Slider(self, command=update_width_max, start=0, end=1500, grid=[1, 5, 2, 1]) s2.value = scanner.width_max def update_height_min(): scanner.height_min = s3.value s3 = Slider(self, command=update_height_min, start=0, end=1500, grid=[1, 6, 2, 1]) s3.value = scanner.height_min # Scan button def test_scanner(): # use scanner to scan card and set last_scan as image taken out = scanner.scan_card() global last_scan last_scan = out[0] # draw contours of left boundary and min-max width x min height box # in red within image dimensions 2592 x 1944 lb = scanner.left_boundary hb = (1944 - scanner.height_min) / 2 ht = 1944 - hb wnb = (2592 - scanner.width_min) / 2 wnt = 2592 - wnb wxb = (2592 - scanner.width_max) / 2 wxt = 2592 - wxb red = [ np.array([[[lb, 0]], [[lb, 0]], [[lb, 1943]], [[lb, 1943]]], dtype=np.int32), np.array([[[wnb, hb]], [[wnt, hb]], [[wnt, ht]], [[wnb, ht]]], dtype=np.int32), np.array([[[wxb, hb]], [[wxt, hb]], [[wxt, ht]], [[wxb, ht]]], dtype=np.int32) ] cv2.drawContours(last_scan, red, -1, (0, 0, 255), 2) # if any contours were detected, draw them in green if out[1] is not None: if len(out[1]) > 0: cv2.drawContours(last_scan, out[1], -1, (0, 255, 0), 3) # if artwork contour was detected, draw it in blue if out[2] is not None: cv2.drawContours(last_scan, [out[2]], -1, (255, 0, 0), 4) # save last_scan cv2.imwrite("data/testpic.jpg", last_scan) p2.value = "data/testpic.jpg" # if artwork image was detected, save it and display the # corresponding card name if one is found if out[3] is not None: cv2.imwrite("data/testscan.jpg", out[3]) p3.value = "data/testscan.jpg" card = CD.get_card(out[3]) if card is None: m1.value = "Card: Not Found" else: m1.value = "Card: " + card.name PushButton(self, command=test_scanner, text="Scan", grid=[1, 7, 2, 1]) # Exit button def close_scanner(): self.hide() PushButton(self, command=close_scanner, text="Exit", grid=[0, 8, 3, 1])