Saw file did not show up, here is the code itself you could copy and paste to a new python file:
import tkinter as tk
from tkinter import ttk, scrolledtext
HTML_TEMPLATE = ''' <input y="{y}" x="0" text="<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li {{ white-space: pre-wrap; }}
</style></head><body style=" font-family:'Liberation Sans'; font-size:9pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">{number}</p></body></html>" font="Liberation Sans,9,-1,5,50,0,0,0,0,0,Regular" rotation="0"/>'''
def generate():
try:
start = int(entry_start.get())
step = int(entry_step.get())
y_step = int(entry_ystep.get())
max_height = int(entry_maxheight.get())
except ValueError:
output_text.delete('1.0', tk.END)
output_text.insert(tk.END, "Please enter valid integers.")
return
count = max_height // y_step
inputs = []
for i in range(count):
number = start + i * step
y = i * y_step
inputs.append(HTML_TEMPLATE.format(number=number, y=y))
full_output = "<diagram projectId=\"0\">\n <inputs>\n" + "\n".join(inputs) + "\n </inputs>\n</diagram>"
output_text.delete('1.0', tk.END)
output_text.insert(tk.END, full_output)
def copy_to_clipboard():
root.clipboard_clear()
root.clipboard_append(output_text.get('1.0', tk.END))
root.update()
# GUI Setup
root = tk.Tk()
root.title("QElectroTech JIC-NFPA Number Generator")
frm = ttk.Frame(root, padding=10)
frm.grid(row=0, column=0)
ttk.Label(frm, text="Starting Number:").grid(column=0, row=0, sticky="e")
entry_start = ttk.Entry(frm)
entry_start.insert(0, "101")
entry_start.grid(column=1, row=0)
ttk.Label(frm, text="Increment:").grid(column=0, row=1, sticky="e")
entry_step = ttk.Entry(frm)
entry_step.insert(0, "1")
entry_step.grid(column=1, row=1)
ttk.Label(frm, text="Y Increment (px):").grid(column=0, row=2, sticky="e")
entry_ystep = ttk.Entry(frm)
entry_ystep.insert(0, "20")
entry_ystep.grid(column=1, row=2)
ttk.Label(frm, text="Max Height (px):").grid(column=0, row=3, sticky="e")
entry_maxheight = ttk.Entry(frm)
entry_maxheight.insert(0, "300")
entry_maxheight.grid(column=1, row=3)
ttk.Button(frm, text="Generate", command=generate).grid(column=0, row=4, columnspan=2, pady=(10, 2))
ttk.Button(frm, text="Copy to Clipboard", command=copy_to_clipboard).grid(column=0, row=5, columnspan=2)
output_text = scrolledtext.ScrolledText(root, width=100, height=25)
output_text.grid(row=1, column=0, padx=10, pady=10)
root.mainloop()