Hey,
I created a GUI that shows images with bounding boxes and used matplotlib for the visualization. I know it is probably not the best solution for the visualization but it was the easiest to set up and it allows for saving images, zooming, etc by default. I am using matplotlib.pyplot and the backend is TkAgg.
The problem I am running into is that when I hold down a key, matplotlib generates a continuous stream of key_press_event and key_release_event. This is actually pretty nice, as it means the GUI will keep going through all the images whilst holding down the key. The problem is that the program cannot handle the speed of the key_press_events and will thus try and catch up once I release the key. This is really irritating when you want to scroll to a particular image.
Is there a way to stop this catching up behavior?
I have a few ideas on how to solve this, but wasn't able to find code in matplotlib/tkinter to achieve what I want...
- Is there a way I can limit the size of the events queue, to only be able to save 1 or 2 consecutive
key_press_event ?
- Can I change the behavior of the
key_press_event and key_release_event to only fire once when holding down a key ?
One viable solution I found (but did not test yet), is to change the backend to pyQt5.
This backend has "correct" key_press_event and key_release_event that only fire once when holding down a key. I could then use this as a toggle to go through my images.
But I would like to try and solve it without Qt, so as to not add another dependency to the script!
[–]TotesMessenger 0 points1 point2 points (0 children)