# ========================================================= # Demonstrate widget relief # ========================================================= # --- import import sys # -- what version of Python an I running? if sys.version_info.major == 3: from tkinter import * from tkinter.font import * py3 = True else: from Tkinter import * from tkFont import * py3 = False # --- global variables lfont=('arial', '10', 'bold') bcolor = 'red' # --- root window root = Tk() root.title('TK Frame Relief Test') f = Frame(root, relief='flat', borderwidth=4, padx=4, pady=4, bg=bcolor) f.grid(row=0, column=0, sticky=N+S+E+W) # -- groove f1 = Frame(f, relief='groove', borderwidth=4, width=200, height=100, padx=4, pady=4, bg='light blue') f1.grid(row=0, column=0) Label(f1, text='groove', font=lfont, bg='light blue', padx=10, pady=10).pack() # --- spacer Frame(f, width=10, bg=bcolor).grid(row=0,column=1) # --- ridge f2= Frame(f, relief='ridge', borderwidth=4, width=200, height=100, padx=4, pady=4, bg='pink') f2.grid(row=0, column=2) Label(f2, text='ridge', font=lfont, bg='pink', padx=10, pady=10).pack() # --- spacer Frame(f, width=10, bg=bcolor).grid(row=0,column=3) # --- raised f3 = Frame(f, relief='raised', borderwidth=4, width=200, height=100, padx=4, pady=4, bg='orange') f3.grid(row=0, column=4) Label(f3, text='raised', font=lfont, bg='orange', padx=10, pady=10).pack() # --- spacer Frame(f, width=10, bg=bcolor).grid(row=0,column=5) # --- sunken f4 = Frame(f, relief='sunken', borderwidth=4, width=200, height=100, padx=4, pady=4, bg='grey') f4.grid(row=0, column=6) Label(f4, text='sunken', font=lfont, bg='grey', padx=10, pady=10).pack() # --- spacer Frame(f, width=10, bg=bcolor).grid(row=0,column=7) # --- flat f5 = Frame(f, relief='flat', borderwidth=4, width=200, height=100, padx=4, pady=4,bg='light green') f5.grid(row=0, column=8) Label(f5, text='flat', font=lfont, bg='light green', padx=10, pady=10).pack() # --- main loop mainloop()