
import tkinter as tk
from tkinter import simpledialog
import Buchstaben

parent = tk.Tk() # Create the object
parent.overrideredirect(1) # Avoid it appearing and then disappearing quickly
parent.withdraw() # Hide the window as we do not want to see this one

text = simpledialog.askstring('Input', 'Text in Matrix:', parent=parent)

matrix = "const char data1[] PROGMEM = { \n"
print("const char data1[] PROGMEM = { ")

for i in text:
    if ord(i) == 32:
        matrix += Buchstaben.chars[26] + "            0b00000000," + "\n"
        print(Buchstaben.chars[26] + "            0b00000000,")
    elif ord(i) == 33:
        matrix += Buchstaben.chars[27] + "            0b00000000," + "\n"
        print(Buchstaben.chars[27] + "            0b00000000,")
    elif ord(i) > 90:
        matrix += Buchstaben.chars[ord(i)-97] + "            0b00000000," + "\n"
        print(Buchstaben.chars[ord(i)-97] + "            0b00000000,")
    else:
        matrix += Buchstaben.chars[ord(i)-65] + "            0b00000000," + "\n"
        print(Buchstaben.chars[ord(i)-65] + "            0b00000000,")

matrix += " };"
print(" };")

info = simpledialog.askstring('Output','Copy the following with CTRL+A and CTRL+C', initialvalue=matrix, parent=parent)