Is there maybe a library in python 3.x.x to get outside information like the color at a specific pixel not in python but for example in the browser or in a game? I want to experiment with python being in the background and distinguishing things happening on my current opened window or fullscreen application. I would highly appriciate a simple example.
Asked
Active
Viewed 33 times
0
-
1Does this answer your question? https://stackoverflow.com/questions/2846947/get-screenshot-on-windows-with-python – Thomas Weller Jun 27 '20 at 22:30
-
Most probably not, i would like to make a behavior for a game based on what's currently on screen, i do not want to get into hard AI stuff or neural networks and stuff like that. I feel like making screenshots and somehow working with them overtime (because i want to have it active in the background) wouldn't be the most effective way. I know nothing about it currently, so correct me if I'm wrong. – Jun 27 '20 at 22:38
-
1screenshot is the simplest way and probably doing it in different way is too complex and nobody do it. BTW: in some modules you don't have to save screenshot to file and you can get it directly as `numpy.array` – furas Jun 27 '20 at 22:40
-
1[Programming a Bot to Play the "Sushi Go Round" Flash Game](https://inventwithpython.com/blog/2014/12/17/programming-a-bot-to-play-the-sushi-go-round-flash-game/) - it uses module [PyAutoGUI](https://pyautogui.readthedocs.io/en/latest/) to get screenshot and find item on screen. In background it uses module [opencv](https://opencv-python-tutroals.readthedocs.io/en/latest/) (`Computer Vision`) – furas Jun 27 '20 at 22:43
-
Yea i thought it wouldn't maybe make sense to always save screenshots if it runs for a long time, but as i see it doesn't, so thank you furas! – Jun 27 '20 at 22:48
-
1BTW: [Serpent.AI - Game Agent Framework (Python)](https://github.com/SerpentAI/SerpentAI), and [Universe](https://openai.com/blog/universe/), and [GYM](https://gym.openai.com/) – furas Jun 27 '20 at 22:54
-
As i read trough the sushi go round bot tutorial, i see that he is in a window and the bot works with mouse. So my question is, well it's probably easy to make keyboard inputs by another library but would this work on a app that's displayed fullscreen? – Jun 27 '20 at 23:09
-
1first: PyAutoGUI can control [keyboard](https://pyautogui.readthedocs.io/en/latest/keyboard.html) too. As for fullscreen: some programs may use own methods to access keyboard, mouse and even display on screen so there is no answer - you have to write some code to test i. – furas Jun 27 '20 at 23:40