Hello,

I would really appreciate some help with tkinter. Does anyone know how to change border colour of a widget and if it is possible to display border on just one side of the widget (so for example only the left or bottom border)?

I tried to find the answer on the web but I couldn't. Any help would be greatly appreciated

Thanks :)

vitvn,

Thanks for such a quick reply. Tutorial you gave me is very nice and I'll be using it in future. However, I had a look there and I still couldn't find the answer to my problem :( ... maybe im just blind

Does anyone know how to change border colour of a widget

Border colors, AFAIK, are the same as the widget color, so you would have to use an outside, empty widget of one color, and an inside widget of another color, although that is not quite what you want. The PMW toolkit extension does have a bordercolor key word but I have never tried it.

Ok thanks for the help. Ill definitely try pmw :)

And if theres anyone who has any idea how to display border on just one side of the widget id be glad to hear it :)

Take a look at something like this ...

# create a frame with a left side border
# using overlapping frames

import Tkinter as tk

root = tk.Tk()
root.title("left side border")

frame1 = tk.Frame(root, bg='brown', width=400, height=200)
#frame1.grid_propagate(0)
frame1.grid()

frame2 = tk.Frame(root, bg='yellow', width=390, height=200)
frame2.place(x=10, y=0)

root.mainloop()

vegaseat that's a cool trick. thanks :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.