from tkinter import * class Chat: def __init__(self,parent): self.frm_Chat=Frame(parent) self.frm_Chat.pack() self.frm_IncomingText=Frame(self.frm_Chat) self.frm_IncomingText.pack() self.txt_ChatBox=Text(self.frm_IncomingText,height=10,wrap=WORD) self.txt_ChatBox.pack(side=LEFT) self.scr_ChatBoxScroll=Scrollbar(self.frm_IncomingText,orient=VERTICAL,command=self.txt_ChatBox.yview) self.scr_ChatBoxScroll.pack(side=LEFT) self.txt_ChatBox["yscrollcommand"]=self.scr_ChatBoxScroll.set self.frm_OutgoingText=Frame(self.frm_Chat) self.frm_OutgoingText.pack() self.ent_InputText=Entry(self.frm_OutgoingText) self.ent_InputText.pack(side=LEFT) self.btn_SendMessage=Button(self.frm_OutgoingText,text="Send") self.btn_SendMessage.pack(side=LEFT) root=Tk() chatwindow=Chat(root) root.mainloop()