[Tkinter-discuss] experimental tk program in python3

python at bdurham.com python at bdurham.com
Fri Dec 17 15:35:42 CET 2010


Michael,

Ah, I see! The trick seems to be:

- don't set a frame's border width or relief properties (or reset them
to 0 and 'flat')
- set highlightcolor=<bordercolor>
- set highlightbackground=<bordercolor>
- set highlightthickness=<borderwidth>

I think that also answers the question I just posted regarding how to
create the appearance of colored frame borders.

Thank you (one answer for 2 questions!)

Regards,
Malcolm

<snipped>
From: "Michael Lange" <klappnase at web.de>

from Tkinter import *

root = Tk()
f1 = Frame(root, bg='white', highlightthickness=2,
highlightbackground='red', highlightcolor='red', width=200, height=200)
f1.pack(padx=100, pady=100, fill='both', expand=1)
Button( f1, text='Button 1' ).pack()

f2 = Frame(root, bg='white', highlightthickness=2,
highlightbackground='green', width=200, height=200)
f2.pack(padx=100, pady=100, fill='both', expand=1)
Button( f2, text='Button 2' ).pack()

root.mainloop()
</snipped>


More information about the Tkinter-discuss mailing list