/
GUI.py
33 lines (26 loc) · 830 Bytes
/
GUI.py
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
from Tkinter import *
root = Tk()
messages = Text(root)
messages.pack()
input_user = StringVar()
input_field = Entry(root, text=input_user)
input_field.pack(side=BOTTOM, fill=X)
def send(event):
input_get = input_field.get()
if input_get:
messages.insert(INSERT, 'Me: %s\n' % input_get)
input_user.set('')
return "break"
def sendButton():
input_get = input_field.get()
if input_get:
messages.insert(INSERT, 'Me: %s\n' % input_get)
input_user.set('')
Label(root, text= "Message: ").pack(padx = 10, pady = 20, side = LEFT)
enter = Text(root, height = 1, width = 50, wrap = WORD)
enter.pack(padx = 20, pady = 20, side = LEFT)
input_field.bind("<Return>", send)
but = Button(root, text = "Send", command=sendButton)
but.pack(padx = 20, pady = 20, side = LEFT)
#but.place(width = 120, height = 40)
root.mainloop()