[Tkinter-discuss] Techniques for creating the appearance of frames with custom border colors

python at bdurham.com python at bdurham.com
Fri Dec 17 15:00:08 CET 2010


I understand that Tkinter frames do not have a property that
allows their border color to be customized.

Here are some high level ideas I have on how to create a colored
border effect - any suggestions on best practice appreciated.

1. Turn off the frame's border. Enclose the frame in a parent
frame also without a border. Set the parent frame's background
color to the color of the border you want. Make sure the parent
frame's layout options (grid/pack) match the inner frame's
options.

2. Use a canvas instead of a frame, draw a border using the
create_rectangle( ..., fill="<frame backgroundcolor>" ), and then
bind to the canvas's <Config>(?) event and to delete and redraw
the border every time the canvas resizes.

3. Use a tk.call( ... ) to gain access to the TCL interpreter and
its richer set of capabilies?

Regarding options 2 and 3: Might there be a way to create
non-solid border styles, eg. borders that are composed of dots or
dashes?

Thanks for your ideas,
Malcolm
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20101217/63cc1391/attachment.html>


More information about the Tkinter-discuss mailing list