The application allows you to open a text file, split the text into chunks based on a specified maximum number of tokens, and copy the text to the clipboard. This is a simple GUI application built with Python's tkinter
library.
- Open a text file and display its content in the GUI.
- Split the text into chunks based on a specified maximum number of tokens.
- Copy the selected text to the clipboard.
TextProcessor
: This class contains a static methodsplit_text_into_chunks
that splits a given text into chunks based on a specified maximum number of tokens.TextFileReader
: This class inherits fromtk.Tk
and represents the main application window. It contains methods for opening a file, splitting the text, and copying the text to the clipboard.
To run the application, simply execute the script Split-text-app.py
. The GUI will appear and you can interact with it.
- Click the "Open File" button to open a text file.
- Enter a number in the "Max Tokens" field and click "Save Max Tokens" to set the maximum number of tokens for each chunk.
- The text from the file will be displayed in the GUI, split into chunks based on the maximum number of tokens.
- Click on the specific textbox.
- Click the "Select and Copy Text" button to copy all the text in the specific textbox to the clipboard.
- Python 3
- tkinter
- customtkinter
- pyperclip
- re
- os
This application uses the customtkinter
library for custom tkinter widgets. Make sure to install this library before running the application.
![](https://private-user-images.githubusercontent.com/82918531/298399046-15c19828-1595-459f-8b1e-e9551db2f040.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk1NDE0ODYsIm5iZiI6MTcxOTU0MTE4NiwicGF0aCI6Ii84MjkxODUzMS8yOTgzOTkwNDYtMTVjMTk4MjgtMTU5NS00NTlmLThiMWUtZTk1NTFkYjJmMDQwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI4VDAyMTk0NlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTI4MjJjZjA0NWE3NzI1ZTJiMGQwZTgyZWQ1NjFhYTU0N2VhMzdlZGMyZDNkNzNhYjMyOWQ1OWFlNjM2NDNkYWMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.yEWHrVibhpdF6mTepS9BvZyiEzXKnK2F2-x1VvHBUA4)