Python Screenshot Unable to Pick Up Program - python

I am trying to take a screenshot of a program via Python for OCR. The screenshot picks up everything except the desired program and its children windows. I am in Windows 7, and the Windows screenshot function works perfectly.
So far I have tried PIL, Pillow, and Desktopmagic - the latter two are based on PIL, so it is no surprise to me they do not work when PIL does not work.
I am open to any ideas that may work.
Additionally, if possible, I would like to understand why this is happening.

Related

Corrupt JPEG data: 20 extraneous bytes before marker 0xdb OpenCV with macOS Mojave

I am developing a simple app in python 3.7, using face_recognition. Unfortunately a new error started popping up:
"Corrupt JPEG data: 20 extraneous bytes before marker 0xdb"
The full example which I followed in my code is available here
I did research, including:
this,
this,
this, and many others. Restarting the system did nothing, nor did reinstallation of open-cv, and installation of opencv-contrib-python.
As far as I know it's connected to my computer architecture (this seems to only pop up on 64-bit machines), but no one covered that issue for macOS Mojave, and solutions covered in links I attached above don't work for me.
I narrowed it down to the following line, which throws the error. It used to work well, now something changed. No changes were made in code, though. It just started acting out:
facial_recognition(face_recognition.load_image_file('img.jpeg'))
Any ideas?
EDIT: I solved it. It was actually a completely different problem. When you're using pyCharm please remember to close all tabs that are currently running this code in your console. This occurs when you're trying to access the same image file, and modify it at the same time.

Start programs in full-screen (Python)

I tried to open a file, the filename is 1.txt. I tried to open it with webbrowser.open("1.txt") or os.startfile("1.txt") which worked perfectly fine, but I couldn't find any information about how to start programs or anything with Python in full screen. I'm using Linux and Python 3.6.
Any ideas how to perform something like that?
There are more answers to that question than there are GUI toolkits, and there are plenty of toolkits.
I think the first thing you need to do is decide on a GUI toolkit. Research it depending on your necessities (python version, OS support, etc). Once you settle on one, find out how to make a fullscreen app with that. If you can't, ask again.
Good luck.

Python OpenCV unable to handle videos

Hello: I am developing on Linux trying to use Python/OpenCV to process videos.
I have tried using Python2 and Python3 but no results.
import cv2
video = cv2.VideoCapture("myvideo.mp4")
status = video.isOpened()
In this case, status is a boolean and it is always false.
A quick search online pointed to the problem as Python OpenCV module is compiled with FFMPEG library turned on. As a result, it is cannot handle video.
But I am unable to find any solution to it.
Any help much appreciated.
See if you can use ffmpeg from command line and the video (with exactly the same path) as an input for some kind of simple manipulation or conversion.
Doing that, output it as an .avi file with a different coding and see if that makes any difference for OpenCV as an input.
Check if maybe you're able to use the feed from your webcam by modifying the script just a little bit.
Check if the path you provide is correct. Try putting the video in your home folder and providing an absolute path.
Try reinstalling ffmpeg according to these instrcutions.
If none of above work, follow this guide.

Place an image in a specific locaton on a windows desktop using python

I wish to use python to place an image (say jpg or bmp) at a specific location on my Windows 7 desktop. I would also like the ability to drag it around using the mouse and for the python code to store it's final locations coordinates. So when Windows restarts (with the python code configured to run at startup), it reads the stored location and places the image back at its previous location.
Is this possible to do?
If it is, could someone please provide some suggestions on how to do it, as my python experience is pretty limited?
Thanks.
You need to use LVM_SETITEMPOSITION for arranging icons on the desktop.
There are a similar questions:
How can I programmatically manipulate Windows desktop icon
locations?
win32 programming
Python is not the best choice for this job, but if it's required try to look in to - commctrl, win32gui, and pywin32 libraries

Python: Two Windows Opening

ok so for the past two weeks or so, ive been learning python as it is extremely simple to comprehend and a very handy method of creating a GUI for a program. However i have three problems.
First, when i open my .py file a command window opens , and then my program opens on top of that. Is there a way to just open the program? (and not the command window)
Second, ive been eagerly searching for a simple method of compiling (or "interpreting")
my .py filesinto .exe files. ive come across a few people saying that the program called py2exe is the best method, however i cant get it to work... Are there any easier methods for compiling python source codes into executable files?
Third, can anyone refer me to a site with a list of modules for python, along with their descriptions and.or examples? this would greatly help me as i tried using the built in help commands in the python command line, but i find that too generic, like it gives the syntax but no examples of what applications each command/module has.
P.S: Just wondering, is there a site that offers example programs (and their source codes) that were made with python that i could take a look at to better understand this language?
(examples: Python Games, Python GUI applications, Python Questionaires, Any Python Programs/applications that demonstrate the language's usefulness)
INFORMATION:
OS: WINDOWS 7: Ultimate Edition
Python Version: 2.6
Thanks in Advance!
To keep the command window from opening, you can save it as a .pyw file, as opposed to the usual .py. As for converting to exe, py2exe works best for me, I know there are several others, but not as fully developed as py2exe is. Python.org should contain a list of most modules. The same results could easily be procured by googling python modules.
EDIT:
Also, as for the gui, I have found that I personally like pyqt and tkinter best.
Use pythonw.exe instead of python.exe to run your program.
I use cx_freeze; docs on their website.
PyPI

Categories