我正试图重建一个屏幕记录PyQt应用程序,ScreenToGIF对我来说是一个非常好的演示,它创建了一个界面,它只在“中央小部件”中有边框和记录内容,如下所示:
主要功能包括:
但是,它是用C实现的(link:https://github.com/NickeManarin/ScreenToGif),我想知道是否有可能在不学习C的专业知识的情况下制作一个类似的PyQt应用程序?在
Changing the background image of QMainWidgets to the desktop area been overlayed doesn't make sense, because mouse operation on desktop (such as double click to open files) should be recorded. Mouse event can penetrate the app (like Qt.WindowTransparentForInput applied for inner contents?)
你想要实现的是设置一个mask,这样你就可以拥有一个不必是矩形的特定“形状”的小部件。在
主要的困难是理解window geometries是如何工作的,这可能很棘手。
你必须确保窗口“框架”(包括它的边距和标题栏-如果有的话)已经被计算出来,然后找出内部矩形并相应地创建一个遮罩。{{1}我认为这两种操作系统都是在Linux下实现的。如果你确定你的程序只能在Windows上运行,那就有评论了。在
最后,我只能在Linux、Wine和虚拟化的WinXP环境中运行它。它在任何系统上都能正常工作,但是,根据我的经验,有一个特殊的“装饰性”缺陷:标题栏不是根据当前的Windows主题绘制的。我认为这是因为每当应用掩码时,底层windows系统不会像通常那样绘制“样式化”的窗口框。如果这种情况也发生在较新的系统中,那么可能是一个解决办法,但这并不容易,我不能保证它能解决这个问题。在
NB:请记住,这种方法不会允许永远在“抓取矩形”内绘制任何内容(没有阴影,也没有半透明的色板);原因是,您显然需要实现与窗口小部件“下方”的鼠标交互,而在其上绘制则需要更改覆盖遮罩。在
请试试这个
相关问题 更多 >
编程相关推荐