sage19175
Posts: 1
Joined: Wed Aug 09, 2017 3:13 am

First time using python, need some help with pictures.

Wed Aug 09, 2017 3:43 am

Ok bare with me this is the first program i have written in python.
The idea of the program is to be able to scan bar-codes and have it play a corresponding video, that part works fine.
But I also want the screen to be either black or display some other picture like "please scan object" or something at all times when the videos aren't playing, basically once I start this program I don't want to see the Rasbian desktop.
And this is where I seem to be having trouble, first when I start the program the screen goes black like it should but then as soon as I scan something it closes the black picture and I have to re-scan whatever I just scanned to open the video.
Second whenever the black picture is up there is text showing what file is open etc at the bottom of the screen that I don't want there.
I don't even know if fbi is the best way to do this so any suggestions would be helpful :D
Thanks in advance!

Code: Select all

while True:
     import os
     os.system("sudo fbi -d /dev/fb0 -a -T 2 -v black-screen.jpg")
     name=input("Please scan object")
     addressbook = open("ab.txt")
     for line in addressbook:
                     record = line.split('|')
	     if record[0] == name:
		     found = True
		     break
	     else:
	 	     found = False
	 	     continue
     if found == False:
	     print("Object not found")	
     else:
             number=(record[1])
             path=("/media/pi/USB DISK/Pyro Preview/videos/")
             os.system("sudo killall fbi")
             import sys
             movie_path = ((path)+(number))
             from subprocess import Popen
             omxp = Popen(['omxplayer',movie_path])

User avatar
topguy
Posts: 3716
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: First time using python, need some help with pictures.

Thu Aug 10, 2017 10:06 pm

You could disable the desktop and start your program from commandline, one less problem to deal with.
Also using PyGame to create the black screen with "Scan code" text is probably simpler to handle. There are some details with framebuffers in relation to fbi and omxplayer.

Return to “Python”

Who is online

Users browsing this forum: Bing [Bot] and 13 guests