简体   繁体   English

如何以编程方式在 python 中录制窗口/GUI 应用程序?

[英]How do I programmatically video record a window / GUI application in python?

I would like to video record a GUI application (specifically RViz) programmatically since I am running an experiment multiple times and would like to automate and synchronize those recordings with the run.我想以编程方式对 GUI 应用程序(特别是 RViz)进行视频录制,因为我正在多次运行实验,并希望将这些录制内容与运行自动化和同步。 RViz itself offers no recording service and recommends SimpleScreenRecorder. RViz 本身不提供录制服务,推荐使用 SimpleScreenRecorder。 Are there any libraries that offer this functionality?是否有提供此功能的库?

System: Linux (Ubuntu)系统:Linux(Ubuntu)

Preferred language: python首选语言:python

I didn't find any suitable tools so I wrote up my own that should work on all Linux systems: https://github.com/LemonPi/window_recorder我没有找到任何合适的工具,所以我自己写了一个应该适用于所有 Linux 系统的工具: https : //github.com/LemonPi/window_recorder

You use it as a context manager, supplying either no window names to prompt you to click a window, or a list of window names to attempt to capture (the first one that's valid gets matched).您将其用作上下文管理器,不提供窗口名称以提示您单击窗口,或者提供要尝试捕获的窗口名称列表(匹配第一个有效的名称)。 For example,例如,

from window_recorder.recorder import WindowRecorder
import time

# passing in nothing as the window name will allow you to select the window by clicking
# want to capture an RViz window, which could have name "RViz*" as well
with WindowRecorder(["RViz*", "RViz"], frame_rate=30.0, name_suffix="rviz"):
    # do things...
    time.sleep(0.1)
    start = time.time()
    while time.time() - start < 2:
        time.sleep(0.1)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python-如何在视频中录制应用程序窗口? - Python - How to record an application window to a video? tkinter GUI 中的录制视频按钮 python - Record Video Button in tkinter GUI python 如何使用 python 构建视频聊天应用程序 - How do I build a video chat application using python 在python tkinter的GUI中完成视频后,如何打开另一个GUI窗口? - How to open another GUI window, once video is completed in GUI in python tkinter? 如何在python PyQt GUI应用程序中隐藏控制台窗口 - How to hide console window in python PyQt GUI application 如何通过输入ID号使python GUI在弹出窗口中显示信息? 还有错误消息? - How do I make the python GUI display info in a popup window by entering an ID number? And an error message? 如何在Python中使用win32gui关闭带句柄的窗口 - how do I close window with handle using win32gui in Python 如何获取程序来更新GUI窗口中的增量? (python 3) - How do I get my program to update the increment in the GUI window? (python 3) 从终端运行Python文件时,如何打开GUI窗口? - How do I open a GUI window when running a Python file from Terminal? 如何设置Python wxWidgets应用程序窗口的类名? - How Do I Set the Class Name of a Python wxWidgets Application Window?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM