from
tkinter
import
*
from
tkinter
import
messagebox
app
=
Tk()
def
compare_string():
string1
=
entry_widget1.get()
string2
=
entry_widget2.get()
if
string1
=
=
string2:
a
=
"Strings are same"
else
:
a
=
"Strings are different"
messagebox.showinfo(
"Compared Strings"
, a)
def
concat_string():
string1
=
entry_widget1.get()
string2
=
entry_widget2.get()
messagebox.showinfo(
"Compared Strings"
,
'Concatenated String: '
+
string1
+
string2)
canvas_widget
=
Canvas(app, width
=
500
,
height
=
500
)
canvas_widget.pack()
label_widget1
=
Label(app, text
=
"Enter the string 1"
)
canvas_widget.create_window(
150
,
160
,
window
=
label_widget1)
label_widget2
=
Label(app, text
=
"Enter the string 2"
)
canvas_widget.create_window(
350
,
160
,
window
=
label_widget2)
entry_widget1
=
Entry(app)
canvas_widget.create_window(
150
,
200
,
window
=
entry_widget1)
entry_widget2
=
Entry(app)
canvas_widget.create_window(
350
,
200
,
window
=
entry_widget2)
button_widget
=
Button(text
=
'Concatenate the strings'
,
command
=
concat_string)
canvas_widget.create_window(
150
,
250
, window
=
button_widget)
button_widget
=
Button(text
=
'Compare the strings'
,
command
=
compare_string)
canvas_widget.create_window(
350
,
250
, window
=
button_widget)
app.mainloop()