3
The menu edge color is given by the background color (background) of the menu. If you want the border color to be different from the menu background color, you have to set the background color of each entry separately.
For edge thickness, simply set the value in pixels in the attribute "border", and the type of relief "flat" so that Tkinter does not create a pseudo-3D with the given color.
So, given the image above, let’s create a menu window, black menu background and red border:
import tkinter
def command():
pass
def main():
w = tkinter.Tk()
menu = tkinter.Menu(w, background="black", foreground="red")
file_menu = tkinter.Menu(menu, background="red", foreground="red", relief="flat", border=8, tearoff=0)
opcoes = "Contas User Usuários Email Services Login Cad. Usuário Variáveis do Sistema Sair".split(" ")
for opcao in opcoes:
file_menu.add_command(label=opcao, command=command, background="black")
menu.add_cascade(label="Cadastro", menu=file_menu)
w.config(menu=menu)
return w
main()
tkinter.mainloop()
(this code is for Python 3 - in Python 2 just exchange "Tkinter" for "Tkinter" at all points)
If you want to change the background color or some other attribute of a menu entry after it is created, use the method in the menu:
file_menu.entry_config(0, ...)
Where 0 is the desired input index.