FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix whole_screenshot by ss2nddiv · Pull Request #3 · lochen88/MBPython · GitHub

Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
16 changes: 12 additions & 4 deletions MBPython/screenshot.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
# -*- coding:utf-8 -*-
from ctypes import windll
from ctypes import windll,create_string_buffer,byref,c_int,c_void_p,c_longlong
import platform
from .winConst import WinConst
import win32gui, win32ui
import win32ui
from struct import pack
import collections
import zlib


_LRESULT = c_longlong if platform.architecture()[0]=='64bit' else c_int


user32=windll.user32
def to_png(data, size, level=6, file_name=None):
width, height = size
Expand Down Expand Up @@ -109,16 +113,20 @@ def whole_screenshot(mb,webview,file_name):

left=0
top=0
mb.wkeGetContentWidth.argtypes = [_LRESULT]
mb.wkeGetContentHeight.argtypes = [_LRESULT]
width=mb.wkeGetContentWidth(webview)
height=mb.wkeGetContentHeight(webview)
pixels=create_string_buffer(width*height*4)
mb.wkeResize(webview,width,height)
mb.wkeUpdate()
mb.wkePaint.argtypes = [_LRESULT,c_void_p,c_int]
mb.wkePaint(webview,byref(pixels),0)
img=pixelsParse(data=bytearray(pixels), left=left
,top=top,width=width,height=height)
to_png(img.rgb, img.size, level=6, file_name=file_name)
pixels=None
img=None
return True

return True



Back | FazBrowse Home | New Git URL