def __init__(self, master, callback, dest_user=None): self.dest_user = dest_user self.display = ttk.Frame(master) self.display.pack(side='top') scrollbar = ttk.Scrollbar(self.display) self.text_display = ReadOnlyText(self.display, width=45, height=36, yscrollcommand=scrollbar.set, wrap='word', borderwidth=0) scrollbar.config(command=self.text_display.yview) # text input area self.textinput = tkinter.Text(self.display, width=35, height=10, wrap='word') self.textinput.bind('<Control_L><Return>', callback) if not dest_user: # if no dest_user (Welcome window), disable textinput self.textinput.insert(tkinter.END, 'Select a peer first') self.textinput.config(state='disabled') else: self.textinput.insert(tkinter.END, 'Please type') # pack self.textinput.pack(side='bottom', fill='both', expand=True) scrollbar.pack(side='right', fill='y') self.text_display.pack(side='left', fill='both', expand=True)