This Python script provides a simple GUI to convert hexadecimal color codes to the integer color format used by App Inventor. The script is built using Tkinter for the graphical user interface, and also utilizes the
pyperclip library to copy the result to the clipboard.
Required Python Libraries
This script relies on the following Python libraries:
Tkinter: A standard Python library for creating lightweight and simple GUIs. This is included with most Python installations, but if it’s not present, you can usually add it via your distribution’s package manager.
pyperclip: A Python library for cross-platform clipboard code. It handles copying the output color integer to your clipboard for easy pasting. Install it using pip:
pip install pyperclip
- Run the script. It opens a small window with an input field and a “Convert” button.
- Enter a hexadecimal color code into the field. The color code can optionally include the preceding “#”. If the color code does not include an alpha channel, it will be assumed to be “FF”.
Enteror click “Convert”. The equivalent App Inventor color integer will be copied to your clipboard and also displayed in a message box.
- The message box will automatically dismiss after 5 seconds.
- Clicking inside the input field will clear its content, ready for a new conversion.
color_converter.zip (951 Bytes)