I'm trying to make a programm with python to take screenshots out of a rectangle you draw on your screen, but first, I'd prefer to determine the dimensions. How can I do that? How can I draw a rectangle and then get the size of it? I'm trying to use pyautogui or PILLOW, but I still need practice. I also thought about using tkinter to make a transparent window and then doing it from there, but I can't figure out how to do it on Lubuntu 18.04.
And if you have any other recommendations or advice about the screenshot part, It's welcome!
Hope the problem it's clear, thank you in advance! ;)
Related
Looking for a way to be able to find the color data of a pixel(s) on a Canvas. I'm sort of a beginner to coding, just gauging if this is possible/how to go about this. This is for a project I've been working on, and for part of it, it's necessary to compare the color data of a Canvas to an Image. I know how to find the per pixel color data of an Image, but I haven't found anything for a canvas. I'm using a Tkinter Canvas at the moment, but if it's not possible on that library, I'm open to switching to another library. Any ideas? Thanks guys!
Looking for a way to be able to find the color data of a pixel(s) on a Canvas.
Tkinter doesn't provide the ability to do this.
I am developing an app for Android and i have this issue - after i have taken a picture with the camera, i need to crop it. But the coordinates for the rectangle i have dragged over the capturing area start from the screen's 0,0 coordinates aka touch coordinates do not match actual picture's - if i try to crop the image with these using PIL, i get a partial result.
One possible solution would be to take a partial screenshot with these coordinates and get the cropped picture that way.
I tried to use pyscreenshot, but then i found out that it does not work on Android.
Any ideas how to capture a partial screenshot on Kivy?
Thank you
For possible anyone with the same issue - i did not find any good way to grab a screenshot and crop selected portion out of it. I did, however, solve it this way - i move to a new screen, resize picture to device's screen resolution and from then i can crop it with touch without no issues - i did not have to find a clever way to map screen coordinates with image's. After cropping and saving i resize the image back to a fixed resolution. This is not a elegant solution, but still will serve my purpose.
Thank you anyone who thought along with me.
The title explains it self basically, I want to draw for example a rectangle on a specific coordinate on the screen, using Python, how to achieve this?
I hear PyGame mentioned frequently, but I need a solution that would allow me to click through the shape, and as far as I understand you definitely need a Pygame window to draw anything on the screen and that would prevent clicking on whatever it is underneath, am I correct?
First image:
Second image:
The first image shows what I'm getting at this moment.
But I just want to make it as the 2nd image which is looking transparent for all widgets. Apparently tkinter widgets does not support transparency. How can I make my GUI like second image?
Any help would be appreciated.
I know question is asked long ago, but I(and probably still many beginners like myself) was bothered with same thing and I came up with some kind of solution.
I've just cut part of background of exact place where button is placed with exact measurements and I achieved something similar to transparency by placing that cropped image as background of a button, label....
Not a "coded" solution but worked for me.
I've been using pygame to make a game recently, and have ran into a little problem...
Basically, I would like to be able to stretch the whole image that is on the screen (all the things that I have blitted to it) into the resolution which the user has resized the window to. I've searched a lot on the documentation for pygame and on stack overflow and I can't seem to find an answer... Is it even possible? The source code for my game is pretty big atm, if anyone needs it I'll be willing to post it. Sorry if I made my question a little unclear :)
Blit everything to a separate surface (not directly to the screen), let's call it main_surface. Then blit the main_surface to the screen.
Call pygame.transform.scale(main_surface, (width, height) with the new width and height that you get from the VIDEORESIZE event to scale the main_surface and everything in it to the new window dimensions.