当前位置: 首页>>代码示例>>Python>>正文


Python pyscreenshot.grab方法代码示例

本文整理汇总了Python中pyscreenshot.grab方法的典型用法代码示例。如果您正苦于以下问题:Python pyscreenshot.grab方法的具体用法?Python pyscreenshot.grab怎么用?Python pyscreenshot.grab使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyscreenshot的用法示例。


在下文中一共展示了pyscreenshot.grab方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _capFrame

# 需要导入模块: import pyscreenshot [as 别名]
# 或者: from pyscreenshot import grab [as 别名]
def _capFrame(self):
        img = grab(self.bbox)
        return np.array(img) 
开发者ID:ManiacalLabs,项目名称:BiblioPixelAnimations,代码行数:5,代码来源:ScreenGrab.py

示例2: screenshot

# 需要导入模块: import pyscreenshot [as 别名]
# 或者: from pyscreenshot import grab [as 别名]
def screenshot(s):
    name = tempdir + '/screenshot'+str(random.randint(0,1000000)) + '.png'
    if(os.name == 'posix'): # se for unix-like
        img = pyscreenshot.grab()
        img.save(name)
    elif(os.name == 'nt'): # se for windows
        img = ImageGrab.grab()
        img.save(name)

    with open(name ,'rb') as f: 
        l = f.read(1024)
        l = name + '+/-' + l
        while(l):
            s.send(l)
            l = f.read(1024)

    print('sent')
    s.shutdown(socket.SHUT_WR)
    os.remove(name) 
开发者ID:tarcisio-marinho,项目名称:RSB-Framework,代码行数:21,代码来源:backdoor.py

示例3: exec_command

# 需要导入模块: import pyscreenshot [as 别名]
# 或者: from pyscreenshot import grab [as 别名]
def exec_command(update, context):
    command_text = update.message.text
    if(update.effective_chat.id in permitted_users):
        if(command_text[0] == "/"):
            if command_text == "/screenshot":
                filename = screenshot_location + "screenshot_%s.png" % str(update.effective_chat.id)
                logging.info("Sending screenshot")
                im = ImageGrab.grab()
                im.save(filename)
                photo = open(filename,'rb')
                context.bot.send_photo(update.effective_chat.id,photo)
        else:
            command = command_text.split()
            try:
                output = subprocess.check_output(command, cwd= curr_dir).decode('utf-8')
                logging.info("%s: %s", command, output)
                if output:
                    context.bot.send_message(chat_id=update.effective_chat.id, text=output)
                else:
                    context.bot.send_message(chat_id=update.effective_chat.id, text=update.message.text)
            except Exception as e:
                context.bot.send_message(chat_id=update.effective_chat.id, text=str(e))
    else:
        context.bot.send_message(chat_id=update.effective_chat.id, text="You don't have permission to use this bot!") 
开发者ID:krishnanunnir,项目名称:server_monitor_bot,代码行数:26,代码来源:start.py

示例4: mss_grab

# 需要导入模块: import pyscreenshot [as 别名]
# 或者: from pyscreenshot import grab [as 别名]
def mss_grab(bbox):
            sct_img = sct.grab(monitor)
            img = Image.frombytes('RGBA', sct_img.size, bytes(sct_img.raw), 'raw', 'BGRA').crop(bbox)
            img = img.convert('RGB')

            return img 
开发者ID:ManiacalLabs,项目名称:BiblioPixelAnimations,代码行数:8,代码来源:ScreenGrab.py

示例5: main

# 需要导入模块: import pyscreenshot [as 别名]
# 或者: from pyscreenshot import grab [as 别名]
def main(output_dir, interval, total):
    i = 0
    while True:
        i += 1
        time.sleep(interval)
        image = pyscreenshot.grab()
        output = os.path.join(output_dir, "screenshot_{}.png").format(i)
        image.save(output)
        print("[+] Took screenshot {} and saved it to {}".format(
            i, output_dir))
        if total is not None and i == total:
            print("[+] Finished taking {} screenshots every {} "
                  "seconds".format(total, interval))
            sys.exit(0) 
开发者ID:PacktPublishing,项目名称:Python-Digital-Forensics-Cookbook,代码行数:16,代码来源:screenshotter.py

示例6: capture_display

# 需要导入模块: import pyscreenshot [as 别名]
# 或者: from pyscreenshot import grab [as 别名]
def capture_display(file_path):
    """ Capture whole display to file ``file_path``

    *Notes*: This keyword saves the whole virtual screen(monitor), while the
    familiar WebApp.`Screenshot Capture` only saves the portion of the web
    browser. But in contrast, the WebApp.`Screenshot Capture` could do `fullpage
    capture` depending on the content of the browser.
    """
    pyscreenshot.grab(childprocess=True).save(file_path)
    BuiltIn().log("Saved current display to file `%s`" % file_path) 
开发者ID:bachng2017,项目名称:RENAT,代码行数:12,代码来源:Common.py

示例7: get_screenshot_linux_1

# 需要导入模块: import pyscreenshot [as 别名]
# 或者: from pyscreenshot import grab [as 别名]
def get_screenshot_linux_1():
    '''
    不支持预选定area
    '''
    im = pyscreenshot.grab() 
开发者ID:voldikss,项目名称:WechatGameAutoPlayer,代码行数:7,代码来源:screenshots.py

示例8: get_screenshot_windows

# 需要导入模块: import pyscreenshot [as 别名]
# 或者: from pyscreenshot import grab [as 别名]
def get_screenshot_windows():
    img = ImageGrab.grab([100, 100, 400, 400]) 
开发者ID:voldikss,项目名称:WechatGameAutoPlayer,代码行数:4,代码来源:screenshots.py

示例9: grab_whole_screen_to

# 需要导入模块: import pyscreenshot [as 别名]
# 或者: from pyscreenshot import grab [as 别名]
def grab_whole_screen_to(file_path):
    img = ImageGrab.grab()
    img.save(file_path) 
开发者ID:PacktPublishing,项目名称:Python-for-Everyday-Life,代码行数:5,代码来源:grab.py

示例10: grab_screen_area_to

# 需要导入模块: import pyscreenshot [as 别名]
# 或者: from pyscreenshot import grab [as 别名]
def grab_screen_area_to(left, upper, right, bottom, file_path):
    img = ImageGrab.grab(bbox=(left, upper, right, bottom))
    img.save(file_path) 
开发者ID:PacktPublishing,项目名称:Python-for-Everyday-Life,代码行数:5,代码来源:grab.py

示例11: screenshot

# 需要导入模块: import pyscreenshot [as 别名]
# 或者: from pyscreenshot import grab [as 别名]
def screenshot():
    """Takes a screenshot of bot's monitors and sends it to the master.\n"""
    buffer = BytesIO()
    try:
        im = ImageGrab.grab()
        im.save(buffer, format='PNG')
        im.close()
        b64_str = str(b64encode(buffer.getvalue()))
        sender(b64_str[2:-1])
    except Exception as exception:
        sender('reachedexcept')
        sender(str(exception))


# TODO: Test on Windows 
开发者ID:4n4nk3,项目名称:TinkererShell,代码行数:17,代码来源:TinkererShell.py

示例12: screenshot

# 需要导入模块: import pyscreenshot [as 别名]
# 或者: from pyscreenshot import grab [as 别名]
def screenshot(self, bbox=(566, 220, 968, 823)):
		return pyscreenshot.grab(bbox=bbox) 
开发者ID:CharlesPikachu,项目名称:AIGames,代码行数:4,代码来源:autoplay.py

示例13: screenshot

# 需要导入模块: import pyscreenshot [as 别名]
# 或者: from pyscreenshot import grab [as 别名]
def screenshot(self):
        """ Takes a screenshot and uploads it to the server"""
        screenshot = ImageGrab.grab()
        tmp_file = tempfile.NamedTemporaryFile()
        screenshot_file = tmp_file.name + ".png"
        tmp_file.close()
        screenshot.save(screenshot_file)
        self.upload(screenshot_file) 
开发者ID:kaiiyer,项目名称:backnet,代码行数:10,代码来源:agent.py


注:本文中的pyscreenshot.grab方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。