The window is on the back when running from Pycharm

No window appears when I attempt to display one using OpenCV’s imshow() function in Python.

When running from a Terminal app, there is no problem. However, it still does not appear when executed from the terminal tab within Pycharm.

This script terminates after a set period, leaving no opportunity to view the window.

I scoured the internet but found no one experiencing the same issue. Though some posts seemed similar, they ultimately differed. I thought, “What is this?” but I solved it.


Just displayed on the back

I was using macOS, and due to the design of its Python version, windows appeared behind the frontmost window. This issue does not occur on Windows.

It seems like something could be done to change it.

It was not a big problem once I realized what was happening, but it was hard to notice.

If you’re developing on a laptop, chances are you’re displaying windows in full screen.

I resolved the issue by adjusting the IDE window’s size and position to occupy the right half of the screen.

You can also click on the Python app icon

If you are developing on a laptop machine, or if shrinking the window size is inefficient, etc., the Python icon will appear in the Dock, and clicking on it will move the window to the frontmost. Of course, you will have to click on it each time you run the program, but the window will be moved to the frontmost.

Reproduce outside of Pycharm

However, this issue does not indicate any deficiencies in Pycharm. On the contrary, I reproduced it when I ran it from the terminal. The Terminal window’s position did not overlap with that of the Python window.

Let's share this post !