Text files should have logical sorting of filenames. So 2 appears before 10, and 4 doesn't appear after 30, etc. You can see this issue in your preview.png image.
webp image support. for img_ext in [".png", ".jpg", ".jpeg", ".gif", ".webp"]:
Maybe use a more desaturated color for the delete token highlight. Something like "#ffcac9"
Minor bug: The previously selected image and tags are still displayed when selecting a new directory.
You could fix this by auto-selecting the first img-txt pair when choosing a directory.
Minor bug: Selecting a folder, then clicking "Choose Directory" and not selecting a file path results in the img-txt pairs being selectable, but tokens no longer show up.
Major bug: Duplicate tags shown in the ui are being saved to the text file as duplicate tags.
This first image shows the tags and the raw text file. As you explained, duplicate tokens are displayed for ease of analysis, that's not the issue.
![Raw_Before_Saving](https://private-user-images.githubusercontent.com/70049990/284447781-2ad82193-d632-4ca0-9eb9-2b5487566158.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTgzNjUzOTAsIm5iZiI6MTcxODM2NTA5MCwicGF0aCI6Ii83MDA0OTk5MC8yODQ0NDc3ODEtMmFkODIxOTMtZDYzMi00Y2EwLTllYjktMmI1NDg3NTY2MTU4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjE0VDExMzgxMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTdiY2ViMWJjNWVlNTc3ZjQ4NWM2NTliMGY4NDEzZDUxYzFkZjA5NTBiODI4OTcyYWNmNDJhM2RhMDM3OTgwYjQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.FAffBsoWr2bR5XadcUhR8x0obXYKL8DxFq231u5Hl9Y)
In the second image all I did was click save. This caused the duplicate tokens displayed in the ui to be written to the text file. It also repositioned the token order, but that's pretty minor.
![After_clicking_save](https://private-user-images.githubusercontent.com/70049990/284448343-f75f7cab-5571-4f04-aef7-394e0a7733fb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTgzNjUzOTAsIm5iZiI6MTcxODM2NTA5MCwicGF0aCI6Ii83MDA0OTk5MC8yODQ0NDgzNDMtZjc1ZjdjYWItNTU3MS00ZjA0LWFlZjctMzk0ZTBhNzczM2ZiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MTQlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjE0VDExMzgxMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTRmOTY2YTg4YTRmYTg5ZDEwZDEyMWEzYmViZDg2MzVkNTc3ZDdiNDZiNzYzNzUxOThiYzc4MTAzMWI4ZDYyODImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.0e6z8REm1qmMApU47EphnVrUExf2dVg9XLm1_k2TIX0)
Oddly, I had to delete "long hair" twice with 4 clicks.
Major bug: If the user selects a token but doesn't click again to delete it and instead goes to the next/prev image, the token delete function stops working. This is the resulting error when clicking on another token.
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\egegi\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py", line 1921, in __call__
return self.func(*args)
File "C:\Users\egegi\Downloads\EzBooruTagEditor.py", line 273, in <lambda>
tag_label.bind("<Button-1>", lambda event, t=tag, tl=tag_label: self.on_click(t, tl))
File "C:\Users\egegi\Downloads\EzBooruTagEditor.py", line 389, in on_click
self.currently_marked_tag.config(relief="raised", bg=self.currently_marked_tag.original_bg)
File "C:\Users\egegi\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py", line 1675, in configure
return self._configure('configure', cnf, kw)
File "C:\Users\egegi\AppData\Local\Programs\Python\Python310\lib\tkinter\__init__.py", line 1665, in _configure
self.tk.call(_flatten((self._w, cmd)) + self._options(cnf))
_tkinter.TclError: invalid command name ".!frame.!frame3.!frame.!frame.!frame3.!label3"