import tkinter as tk root = tk.Tk() root.geometry("1072x1448") splash = """ _ ___ _ ___ ____ ____ | |/ (_)_ __ __| |_ _| _ \\ / ___| | ' /| | '_ \\ / _` || || |_) | | | . \\| | | | | (_| || || _ <| |___ |_|\\_\\_|_| |_|\\__,_|___|_| \\_\\\\____| Please use /connect address [port] to connect to a server... """ text = tk.Text(root, width=1072, font=("monospace", 25)) root.columnconfigure(index=0, weight=1) root.rowconfigure(index=1, weight=1) def insert(stri): text.configure(state=tk.NORMAL) text.insert(tk.END,stri) text.see("end") text.configure(state=tk.DISABLED) global frame global frame2 global caps global shft caps = False shft = False insert(splash) input = tk.Entry(root, width=1072, font=("monospace", 25)) text.pack() input.pack() def press(key:str): if key == "⇋": pass elif len(key) == 1: input.insert(tk.END, key) else: if key == "SPACE": input.insert(tk.END, " ") elif key == "BKSP": e = input.get()[:-1] input.delete(0, tk.END) input.insert(tk.END, e) input.xview_scroll(500, tk.UNITS) def rebuild_keyboard(): global shft global caps def keyse(k): global shft press(k) if shft: shft = False rebuild_keyboard() global frame global frame2 try: frame.destroy() except: pass try: frame2.destroy() except: pass frame2 = tk.Frame(root, width=1072) space = tk.Button(frame2, font=("monospace", 25), width=45, height=2, text=" ", command=lambda k="SPACE": press(k)) space.grid(row=1, column=1) frame = tk.Frame(root, width=1072) frame.pack() frame2.pack() keys_lower = [ "`", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "", "⇋", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "[", "]", "\\", "", "a", "s", "d", "f", "g", "h", "j", "k", "l", ";", "'", "", "", "", "z", "x", "c", "v", "b", "n", "m", ",", ".", "/" ] keys_capper = [ "`", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "=", "", "⇋", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "[", "]", "\\", "", "A", "S", "D", "F", "G", "H", "J", "K", "L", ";", "'", "", "", "","Z", "X", "C", "V", "B", "N", "M", ",", ".", "/" ] keys_shift = [ "~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "+", "", "⇋", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", "{", "}", "|", "", "A", "S", "D", "F", "G", "H", "J", "K", "L", ":", '"', "", "", "", "Z", "X", "C", "V", "B", "N", "M", "<", ">", "?" ] keys_shift_cap = [ "~", "!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "_", "+", "", "⇋", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", "{", "}", "|", "", "a", "s", "d", "f", "g", "h", "j", "k", "l", ":", '"', "", "", "", "z", "x", "c", "v", "b", "n", "m", "<", ">", "?" ] if caps: if shft: keys = keys_shift_cap else: keys = keys_capper elif shft: keys = keys_shift else: keys = keys_lower row, col = 0, 1 for key in keys: if key != "": button = tk.Button(frame, font=("monospace", 25), width=3, height=2, text=key, command=lambda k=key: keyse(k)) button.grid(row=row, column=col, padx=2, pady=2) col += 1 if col > 14: col = 1 row += 1 bksp = tk.Button(frame, font=("monospace", 25), width=3, height=2, text="←", command=lambda k="BKSP": keyse(k)) bksp.grid(row=0, column=14) def cap(): global caps caps = not caps rebuild_keyboard() capskey = tk.Button(frame, font=("monospace", 25), width=3, height=2, text="CAP" if not caps else "low", command=cap) capskey.grid(row=2, column=1) def shf(): global shft shft = not shft rebuild_keyboard() shftkey = tk.Button(frame, font=("monospace", 25), width=3, height=2, text="↑" if not shft else "↓", command=shf) shftkey.grid(row=3, column=1) rebuild_keyboard() input.focus() root.mainloop()