├── README.md └── on screen keybord project using python.py /README.md: -------------------------------------------------------------------------------- 1 | # Keybord 2 | "Create an on-screen keyboard project in Python to simulate keyboard input, enhancing accessibility and user interaction in applications." 3 | -------------------------------------------------------------------------------- /on screen keybord project using python.py: -------------------------------------------------------------------------------- 1 | import tkinter as tk 2 | from tkinter import ttk 3 | key = tk.Tk() # key window name 4 | key.title('Keyboard By MR.HACK') # title Name 5 | # key.iconbitmap('add icon link And Directory name') # icon add 6 | # function coding start 7 | exp = " " # global variable 8 | # showing all data in display 9 | def press(num): 10 | global exp 11 | exp=exp + str(num) 12 | equation.set(exp) 13 | # end 14 | # function clear button 15 | def clear(): 16 | global exp 17 | exp = " " 18 | equation.set(exp) 19 | # end 20 | # Enter Button Work Next line Function 21 | def action(): 22 | exp = " Next Line : " 23 | equation.set(exp) 24 | # end function coding 25 | # Tab Button Function 26 | def Tab(): 27 | exp = " TAB : " 28 | equation.set(exp) 29 | # END Tab Button Fucntion 30 | # Size window size 31 | key.geometry('1010x250') # normal size 32 | key.maxsize(width=1010, height=250) # maximum size 33 | key.minsize(width= 1010 , height = 250) # minimum size 34 | # end window size 35 | key.configure(bg = 'black') # add background color 36 | # entry box 37 | equation = tk.StringVar() 38 | Dis_entry = ttk.Entry(key,state= 'readonly',textvariable = equation) 39 | Dis_entry.grid(rowspan= 1 , columnspan = 100, ipadx = 999 , ipady = 20) 40 | # end entry box 41 | # add all button line wise 42 | # First Line Button 43 | q = ttk.Button(key,text = 'Q' , width = 6, command = lambda : press('Q')) 44 | q.grid(row = 1 , column = 0, ipadx = 6 , ipady = 10) 45 | w = ttk.Button(key,text = 'W' , width = 6, command = lambda : press('W')) 46 | w.grid(row = 1 , column = 1, ipadx = 6 , ipady = 10) 47 | E = ttk.Button(key,text = 'E' , width = 6, command = lambda : press('E')) 48 | E.grid(row = 1 , column = 2, ipadx = 6 , ipady = 10) 49 | R = ttk.Button(key,text = 'R' , width = 6, command = lambda : press('R')) 50 | R.grid(row = 1 , column = 3, ipadx = 6 , ipady = 10) 51 | T = ttk.Button(key,text = 'T' , width = 6, command = lambda : press('T')) 52 | T.grid(row = 1 , column = 4, ipadx = 6 , ipady = 10) 53 | Y = ttk.Button(key,text = 'Y' , width = 6, command = lambda : press('Y')) 54 | Y.grid(row = 1 , column = 5, ipadx = 6 , ipady = 10) 55 | U = ttk.Button(key,text = 'U' , width = 6, command = lambda : press('U')) 56 | U.grid(row = 1 , column = 6, ipadx = 6 , ipady = 10) 57 | I = ttk.Button(key,text = 'I' , width = 6, command = lambda : press('I')) 58 | I.grid(row = 1 , column = 7, ipadx = 6 , ipady = 10) 59 | O = ttk.Button(key,text = 'O' , width = 6, command = lambda : press('O')) 60 | O.grid(row = 1 , column = 8, ipadx = 6 , ipady = 10) 61 | P = ttk.Button(key,text = 'P' , width = 6, command = lambda : press('P')) 62 | P.grid(row = 1 , column = 9, ipadx = 6 , ipady = 10) 63 | cur = ttk.Button(key,text = '{' , width = 6, command = lambda : press('{')) 64 | cur.grid(row = 1 , column = 10 , ipadx = 6 , ipady = 10) 65 | cur_c = ttk.Button(key,text = '}' , width = 6, command = lambda : press('}')) 66 | cur_c.grid(row = 1 , column = 11, ipadx = 6 , ipady = 10) 67 | back_slash = ttk.Button(key,text = '\\' , width = 6, command = lambda : press('\\')) 68 | back_slash.grid(row = 1 , column = 12, ipadx = 6 , ipady = 10) 69 | clear = ttk.Button(key,text = 'Clear' , width = 6, command = clear) 70 | clear.grid(row = 1 , column = 13, ipadx = 20 , ipady = 10) 71 | # Second Line Button 72 | A = ttk.Button(key,text = 'A' , width = 6, command = lambda : press('A')) 73 | A.grid(row = 2 , column = 0, ipadx = 6 , ipady = 10) 74 | S = ttk.Button(key,text = 'S' , width = 6, command = lambda : press('S')) 75 | S.grid(row = 2 , column = 1, ipadx = 6 , ipady = 10) 76 | D = ttk.Button(key,text = 'D' , width = 6, command = lambda : press('D')) 77 | D.grid(row = 2 , column = 2, ipadx = 6 , ipady = 10) 78 | F = ttk.Button(key,text = 'F' , width = 6, command = lambda : press('F')) 79 | F.grid(row = 2 , column = 3, ipadx = 6 , ipady = 10) 80 | G = ttk.Button(key,text = 'G' , width = 6, command = lambda : press('G')) 81 | G.grid(row = 2 , column = 4, ipadx = 6 , ipady = 10) 82 | H = ttk.Button(key,text = 'H' , width = 6, command = lambda : press('H')) 83 | H.grid(row = 2 , column = 5, ipadx = 6 , ipady = 10) 84 | J = ttk.Button(key,text = 'J' , width = 6, command = lambda : press('J')) 85 | J.grid(row = 2 , column = 6, ipadx = 6 , ipady = 10) 86 | K = ttk.Button(key,text = 'K' , width = 6, command = lambda : press('K')) 87 | K.grid(row = 2 , column = 7, ipadx = 6 , ipady = 10) 88 | L = ttk.Button(key,text = 'L' , width = 6, command = lambda : press('L')) 89 | L.grid(row = 2 , column = 8, ipadx = 6 , ipady = 10) 90 | semi_co = ttk.Button(key,text = ';' , width = 6, command = lambda : press(';')) 91 | semi_co.grid(row = 2 , column = 9, ipadx = 6 , ipady = 10) 92 | d_colon = ttk.Button(key,text = '"' , width = 6, command = lambda : press('"')) 93 | d_colon.grid(row = 2 , column = 10, ipadx = 6 , ipady = 10) 94 | enter = ttk.Button(key,text = 'Enter' , width = 6, command = action) 95 | enter.grid(row = 2 , columnspan = 75, ipadx = 85 , ipady = 10) 96 | # third line Button 97 | Z = ttk.Button(key,text = 'Z' , width = 6, command = lambda : press('Z')) 98 | Z.grid(row = 3 , column = 0, ipadx = 6 , ipady = 10) 99 | X = ttk.Button(key,text = 'X' , width = 6, command = lambda : press('X')) 100 | X.grid(row = 3 , column = 1, ipadx = 6 , ipady = 10) 101 | C = ttk.Button(key,text = 'C' , width = 6, command = lambda : press('C')) 102 | C.grid(row = 3 , column = 2, ipadx = 6 , ipady = 10) 103 | V = ttk.Button(key,text = 'V' , width = 6, command = lambda : press('V')) 104 | V.grid(row = 3 , column = 3, ipadx = 6 , ipady = 10) 105 | B = ttk.Button(key, text= 'B' , width = 6 , command = lambda : press('B')) 106 | B.grid(row = 3 , column = 4 , ipadx = 6 ,ipady = 10) 107 | N = ttk.Button(key,text = 'N' , width = 6, command = lambda : press('N')) 108 | N.grid(row = 3 , column = 5, ipadx = 6 , ipady = 10) 109 | M = ttk.Button(key,text = 'M' , width = 6, command = lambda : press('M')) 110 | M.grid(row = 3 , column = 6, ipadx = 6 , ipady = 10) 111 | left = ttk.Button(key,text = '<' , width = 6, command = lambda : press('<')) 112 | left.grid(row = 3 , column = 7, ipadx = 6 , ipady = 10) 113 | right = ttk.Button(key,text = '>' , width = 6, command = lambda : press('>')) 114 | right.grid(row = 3 , column = 8, ipadx = 6 , ipady = 10) 115 | slas = ttk.Button(key,text = '/' , width = 6, command = lambda : press('/')) 116 | slas.grid(row = 3 , column = 9, ipadx = 6 , ipady = 10) 117 | q_mark = ttk.Button(key,text = '?' , width = 6, command = lambda : press('?')) 118 | q_mark.grid(row = 3 , column = 10, ipadx = 6 , ipady = 10) 119 | coma = ttk.Button(key,text = ',' , width = 6, command = lambda : press(',')) 120 | coma.grid(row = 3 , column = 11, ipadx = 6 , ipady = 10) 121 | dot = ttk.Button(key,text = '.' , width = 6, command = lambda : press('.')) 122 | dot.grid(row = 3 , column = 12, ipadx = 6 , ipady = 10) 123 | shift = ttk.Button(key,text = 'Shift' , width = 6, command = lambda : press('Shift')) 124 | shift.grid(row = 3 , column = 13, ipadx = 20 , ipady = 10) 125 | #Fourth Line Button 126 | ctrl = ttk.Button(key,text = 'Ctrl' , width = 6, command = lambda : press('Ctrl')) 127 | ctrl.grid(row = 4 , column = 0, ipadx = 6 , ipady = 10) 128 | Fn = ttk.Button(key,text = 'Fn' , width = 6, command = lambda : press('Fn')) 129 | Fn.grid(row = 4 , column = 1, ipadx = 6 , ipady = 10) 130 | capsLK = ttk.Button(key,text = 'capsLK' , width = 6, command = lambda : press('capsLK')) 131 | capsLK.grid(row = 4 , column = 2 , ipadx = 6 , ipady = 10) 132 | Alt = ttk.Button(key,text = 'Alt' , width = 6, command = lambda : press('Alt')) 133 | Alt.grid(row = 4 , column = 3 , ipadx = 6 , ipady = 10) 134 | space = ttk.Button(key,text = 'Space' , width = 6, command = lambda : press(' ')) 135 | space.grid(row = 4 , columnspan = 14 , ipadx = 160 , ipady = 10) 136 | Alt_gr = ttk.Button(key,text = 'Alt Gr' , width = 6, command = lambda : press('Alt Gr')) 137 | Alt_gr.grid(row = 4 , column = 10 , ipadx = 6 , ipady = 10) 138 | open_b = ttk.Button(key,text = '(' , width = 6, command = lambda : press('(')) 139 | open_b.grid(row = 4 , column = 11 , ipadx = 6 , ipady = 10) 140 | close_b = ttk.Button(key,text = ')' , width = 6, command = lambda : press(')')) 141 | close_b.grid(row = 4 , column = 12 , ipadx = 6 , ipady = 10) 142 | tap = ttk.Button(key,text = 'Tab' , width = 6, command = Tab) 143 | tap.grid(row = 4 , column = 13 , ipadx = 20 , ipady = 10) 144 | key.mainloop() # using ending point 145 | --------------------------------------------------------------------------------