(tkinter) Я пытаюсь создать цветное меню над пространством чата. Я пытался изменить переменную side с помощью функции pack (например: .pack (side = tkinter.LEFT)), но так и не получил его. В идеале цветное меню должно быть вверху слева, чат в середине и кнопка ввода + внизу.
import tkinter
import tkinter.scrolledtext
class Interface(tkinter.Frame):
def __init__(self, root):
tkinter.Frame.__init__(self, root)
self.pack()
# The chat where all the texts appears
self.chat = tkinter.scrolledtext.ScrolledText(self)
self.chat.pack(side="top")
self.chat.configure(state='disabled')
# The color choosing
possible_colors= ["normal", "green", "blue", "red", "yellow", "purple"]
self.color= tkinter.StringVar(self)
self.color.set(possible_colors[0])
self.color_menu= tkinter.OptionMenu(self, self.color, *possible_colors)
self.color_menu.pack(side='top')
# The entry space for the chat
self.entry= tkinter.Entry(self)
self.entry.pack(side="left", fill='both', expand='yes')
# The send button
self.button= tkinter.Button(self, text='send', command=self.function_one)
root.bind('<Return>', self.function_one)
self.button.pack(side="bottom")
root = tkinter.Tk()
interface = Interface(root)
interface.mainloop()