简体   繁体   中英

Create new screen buffer with win32api in Python

I want to draw a specific image to my second screen in Windows 7 using Python 3.4. I can get the handle and screen dimensions using pywin32 :

import win32api
screens = win32api.EnumDisplayMonitors()

I get the handles,dimensions of my screens:

[(<PyHANDLE:393217>, <PyHANDLE:0>, (0, 0, 1280, 720)),
(<PyHANDLE:7472233>, <PyHANDLE:0>, (1920, 0, 3360, 900))]

I thought of creating a new buffer with the dimensions of my screen , writing my data/image to the new buffer and setting it as the active screen.

I don't think I can do that with the pywin32 module and I though of accessing the Windows API through ctypes. But I cannot find the functions of the API like described here https://msdn.microsoft.com/en-us/library/windows/desktop/ms685032(v=vs.85).aspx

How can I do that? Thank you!

Can use the win32console module:

=> python
Python 3.4.3 |Anaconda 2.3.0 (64-bit)| (default, Mar  6 2015, 12:06:10) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import win32console
>>> help(win32console.CreateConsoleScreenBuffer)
Help on built-in function CreateConsoleScreenBuffer in module win32console:

CreateConsoleScreenBuffer(...)
    Creates a new console screen buffer

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM