![]() |
cv2.imshow Python is not opening the window on top - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: cv2.imshow Python is not opening the window on top (/thread-24593.html) |
cv2.imshow Python is not opening the window on top - Petko - Feb-21-2020 I'm using python 3.8 and I'm creating a game, where a user is shown a picture and based on that picture he has stuff to do, the problem is, that I have a loop and when the cv2.imshow is before the loop, the picture is opened on top, you don't have to click on the icon, but I need to put the picture after the loop and that's where the problem starts, the image is opening in a window, but I have to click on that window to see the picture. Problem is, the game I've created requires image to be shown for 5 seconds, and the user loses seconds by manually clicking on the window to see the image. The code is: while True: start = input('Press < Y > to start the game or < N > to exit \nDo you want to start the game? ') print(start) if start.upper() == "Y": print("Starting the game") break elif start.upper() == "N": print("End Game \nMaze runner v1.0") quit() else: print("You must choose < Y > or < N >") img = cv2.imread('maze.jpg', 0) window_name = 'image' cv2.imshow(window_name, img) cv2.waitKey(5000) cv2.destroyAllWindows() |