其他应用程序之上的Python OpenCV打开窗口 [英] Python OpenCV open window on top of other applications

查看:195
本文介绍了其他应用程序之上的Python OpenCV打开窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

执行包含以下内容的OpenCV python脚本时:cv2.imshow(img)结果窗口在我的终端窗口后面打开.这是一种轻微的刺激-有什么方法可以使其最初在前面/上面打开吗?

When executing an OpenCV python script containing: cv2.imshow(img) the resulting window opens behind my terminal window. This is a mild irritation - is there any way to get it to initially open in front / on top?

许多人提出了问题(此处

A number of people have asked questions (here and here) about forcing persistent behaviour but this is, I think, simpler.

平台OS X和OpenCV 2.4.11

Platform OS X and OpenCV 2.4.11

推荐答案

解决此问题的一种方法是使用AppleScript从OpenCV最前端"设置所有窗口.

One way to work around this would be to set all windows from OpenCV "frontmost" using AppleScript.

subprocess.call(["/usr/bin/osascript", "-e", 'tell app "Finder" to set frontmost of process "Python" to true'])

这样,所有窗口都应该放在最前面.

This way, all windows should be brought to the front.

这篇关于其他应用程序之上的Python OpenCV打开窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆