-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path147hw.py
More file actions
38 lines (26 loc) · 1002 Bytes
/
147hw.py
File metadata and controls
38 lines (26 loc) · 1002 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# -*- coding: utf-8 -*-
"""
Created on Thu May 5 14:59:19 2022
@author: Ashish Gupta
"""
from tkinter import *
root=Tk()
root.title("Ascii")
root.geometry("400x400")
root.configure(background = 'snow')
enter_word = Entry(root)
enter_word.place(relx=0.5,rely=0.4,anchor=CENTER)
label = Label(root, text = "Name in Ascii : ", bg="light yellow", fg="black")
label2 = Label(root, text = "Enrypted Name : ", bg="light yellow", fg="black")
def asciiConverter():
input_word = str(enter_word.get())
for letter in input_word :
label["text"] += str(ord(letter)) + " "
ascii= int(ord(letter))
encrypted = ascii - 1
label2["text"] += str(chr(encrypted))
btn=Button(root,text="Show name in Ascii and Encrypted Values",command=asciiConverter, bg='gold', fg = 'black')
btn.place(relx=0.5,rely=0.5,anchor=CENTER)
label.place(relx=0.5,rely=0.6,anchor=CENTER)
label2.place(relx=0.5,rely=0.7,anchor=CENTER)
root.mainloop()