Reputation: 684
I have tried all ways to set tkinter message widget border, but still receive any effect. I wonder if it does not have a border attribute? But I can set label and Text border using the same code. Here is my code snippet:
from tkinter import *
root = Tk()
frame = Frame(root)
message = Message(frame, text="hello world", width=200)
message.config(fg="red", borderwidth=100, highlightcolor="green")
frame.pack()
message.pack()
root.minsize(300, 200)
root.mainloop()
this's result:
OS Version:OS X 10.11.4
Python version: 3.52
Upvotes: 0
Views: 1381
Reputation: 8234
You are setting the borderwidth correctly. The issue is that you can't see the changes you are implementing, until your add background
colour and change the relief
of the Frame
and Message
widget. Now try changing the borderwidths with this revised code, and I trust you get the "gotcha" moment.
from tkinter import *
root = Tk()
frame = Frame(root, background='yellow', borderwidth=20, relief=RAISED)
message = Message(frame, text="hello world", width=200)
message.config(fg="red", borderwidth=50, highlightcolor="green",
background='light blue', relief=SUNKEN)
frame.pack()
message.pack()
root.minsize(300, 200)
root.mainloop()
Upvotes: 1