The window is on the back when run from Pycharm

When I display a window in Python with OpenCV’s imshow() function, nothing is displayed.

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

This scripts terminate with the scheduled time, so we can not see anything.

I searched the internet and found no one with the same problem. There were some posts that looked like it, but they were different. I thought, “What is this?” but I solved it.

TOC

Just displayed on the back

I was running on the macOS, and it seems that the macOS version of Python was designed to appear behind one of the frontmost windows; the Windows version did not have this problem.

It seems like something could be done to change it.

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

If you are developing on a laptop machine, you are most likely displaying windows on the entire screen.

I solved the problem by moving the IDE window size and position to the right half.

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. 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

This problem, however, does not mean that Pycharm is bad. I reproduced it when I ran it from the terminal. The terminal window just happened to be in a position where it did not overlap with the Python window.

Let's share this post !

Author of this article

Akira Hayashiのアバター Akira Hayashi Representative, Software Engineer

I am an application developer loves programming. This blog is a tech blog, its articles are learning notes. In my work, I mainly focus on desktop and mobile application development, but I also write technical books and teach seminars. The websites of my work and books are here -> RK Kaihatsu.

TOC