from
tkinter
import
*
def
clearAll() :
text1_field.delete(
1.0
, END)
text2_field.delete(
1.0
, END)
def
convert() :
input_text
=
text1_field.get(
"1.0"
,
"end"
)[:
-
1
]
length
=
len
(input_text)
output_text
=
''
for
i
in
range
(length):
current_char
=
input_text[i]
previous_char
=
None
if
i >
0
:
previous_char
=
input_text[i
-
1
]
if
current_char
=
=
'L'
or
current_char
=
=
'R'
:
output_text
+
=
'W'
elif
current_char
=
=
'l'
or
current_char
=
=
'r'
:
output_text
+
=
'w'
elif
current_char
=
=
'O'
or
current_char
=
=
'o'
:
if
previous_char
=
=
'N'
or
previous_char
=
=
'n'
or
previous_char
=
=
'M'
or
previous_char
=
=
'm'
:
output_text
+
=
"yo"
else
:
output_text
+
=
current_char
else
:
output_text
+
=
current_char
text2_field.insert(
'end -1 chars'
, output_text)
if
__name__
=
=
"__main__"
:
root
=
Tk()
root.configure(background
=
'light green'
)
root.geometry(
"400x350"
)
root.title(
"Converter"
)
headlabel
=
Label(root, text
=
'Welcome to UwU text converter'
,
fg
=
'black'
, bg
=
"red"
)
label1
=
Label(root, text
=
" Text "
,
fg
=
'black'
, bg
=
'dark green'
)
label2
=
Label(root, text
=
"UwU Text"
,
fg
=
'black'
, bg
=
'dark green'
)
headlabel.grid(row
=
0
, column
=
1
)
label1.grid(row
=
1
, column
=
0
)
label2.grid(row
=
3
, column
=
0
)
text1_field
=
Text(root, height
=
5
, width
=
25
, font
=
"lucida 13"
)
text2_field
=
Text(root, height
=
5
, width
=
25
, font
=
"lucida 13"
)
text1_field.grid(row
=
1
, column
=
1
, padx
=
10
, pady
=
10
)
text2_field.grid(row
=
3
, column
=
1
, padx
=
10
, pady
=
10
)
button1
=
Button(root, text
=
"Convert into UwU text"
, bg
=
"red"
, fg
=
"black"
,
command
=
convert)
button1.grid(row
=
2
, column
=
1
)
button2
=
Button(root, text
=
"Clear"
, bg
=
"red"
,
fg
=
"black"
, command
=
clearAll)
button2.grid(row
=
4
, column
=
1
)
root.mainloop()