4

I'm looping through a bunch of images and need to enter a label in the terminal when each image is displayed, kind of like this:

for pic in pics:
  fig = plt.figure()
  plt.imshow(pic)
  lbl = input()
  ...
  plt.close(fig)

The issue is that the figure steals the focus, so instead of just typing I need to keep clicking on the terminal first, then typing. Can this be avoided?

Mastiff
  • 2,101
  • 2
  • 23
  • 38

1 Answers1

4
  1. Try to switch backend from tk to qt

    matplotlib.use("Qt5agg")
    
  2. Or use your own pause or use animate function

Source: https://stackoverflow.com/a/45734500/12366487

0xh3reticc
  • 101
  • 6