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

Wayne Werner waynejwerner at gmail.com
Fri Dec 17 15:22:35 CET 2010


On Fri, Dec 17, 2010 at 8:00 AM, <python at bdurham.com> wrote:

> 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.
>  <snip>
> 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.
> <snip>
> 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?
>

on 2, definitely. Rather than using fill, you could set the outline color,
style, and width (e.g. dash/stipple):
http://effbot.org/tkinterbook/canvas.htm

<http://effbot.org/tkinterbook/canvas.htm>HTH,
Wayne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tkinter-discuss/attachments/20101217/401675ad/attachment.html>


More information about the Tkinter-discuss mailing list