Python graphics on raspberry pi command line - python

I am trying to get / set screen pixels (draw picture, line, circle, box, etc.) without starting x session. i tried google it but no success.
I am new to python. please help

I think the is no way to have graphics without x-session.
The best solution to this is to set boot to desktop and using pygame library create full screen window to draw graphics.

Related

How do I create something as shown below (volume change indicator) in linux?

I would like to show an image with transparent background to indicate something when a key combination is pressed.
Let's say I pressed ctrl+f3, I trigger a python script. Is there anyway I can make that happen?
What python library can I use to show an image without window border and background?
I have figured out how to trigger the file on key press. How to I deal with the (imshow) thing?
Thank you.
show an image without window border and background
This sound like task for some GUI library. There are many available but you would need test them in order to find which one can do it. First feature is generally known as frameless or borderless window. tkinter which ships with python has ability to work this way, see for example tutorialspoint.com tutorial, though I do not know how it will work with alpha channel of your image.

How to Control Screen Brightness Through Python

Is there a way to control screen brightness through Python? For example, I'm using Tkinter right now, and I'm wondering if there is a way I can program a button in tkinter to increase the brightness of the screen (and make another button that decreases the brightness of the screen)?
EDIT: I'm using a Windows computer, it's on Windows 10, but I also need it to work on Windows 7 too.
I used the WMI library and it really worked fine. Here is the code, but this is for Windows. I think it is OS specific so if it doesn't work for you, you should look for a better solution.
import wmi
brightness = 40 # percentage [0-100] For changing thee screen
c = wmi.WMI(namespace='wmi')
methods = c.WmiMonitorBrightnessMethods()[0]
methods.WmiSetBrightness(brightness, 0)
In tkinter you will not be able to adjust screen brightness. You might be able to make a macro and have your python program access it. Also with desktop monitors brightness is set by the monitor so depending on your model you will probably not be able to make any change at all. Good luck :)
Here is a link on using macros. Check it out and maybe find a way to control screen.

Unwanted Rainbow icon on pygame

I'm currently working on a pygame script, which is basically displaying an user interface over a webcam stream. This app is running on raspberry pi, on dual screen via fbcp.
I noticed that a strange rainbow square icon did recently appeared in the upper right corner of the screen.
Looking like this, but smaller :
What is it ? How can i remove the display of this icon ?
Thank you !
I found the answer by myself :
This icon is shown by the raspberry itself to inform about under-voltage issue.
To prevent it from showing, solve the power issue, or remove rpi warnings (not a safe approach), by adding to /boot/config.txt :
avoid_warnings=2

Is it possible to switch two regions of the screen (Windows)?

I am a developer with low vision. Right now I am working on a personal project to improve my ability to make use of large screens and play video games.
Sometimes when using a widescreen monitor up close (within 4-8 inches) I have trouble reading the screen along the edges. This is particularly troublesome when trying to read the clock or use a mini map in a game. It would be nice if I could temporarily switch the edge of the screen with the center.
I have successfully been able to move parts of the screen using screen captures and PyQt (screenshot).
This is nice but I would like to do this while preserving my ability to click or select text in the region. This seems like a rather involved process If I want to use PyQt and somehow pass clicks through to the screen.
For example:
Is there a lower level api that would allow me to tinker with the screen's output? Any suggestions are welcome!
Thanks

Is there a way to prevent display turning off?

I'm writing a presentation software. I control the presentation on my primary screen, and I display it on the second screen. If the image on the second screen doesn't change after a while, my computer turns off the second screen. Off course, I could simply disable powersaving features on my computer, but what I'd like would be to have my software tell the OS not to turn off the second display when it displays fullscreen on it. How can I achieve that? I'm on Linux, and using Python and GTK3.

Categories