I am pretty new to Python and Tkinter, so I hope this question will be easy for the seniors...
I have this checkerboard:
I am using a grid layout management, as can be noticed below:
from tkinter import *
def checkerboard(can):
w = can.winfo_width()
h = can.winfo_height()
cellwidth = w / 4
cellheight = h / 4
for row in range(4):
for col in range(4):
x1=col * cellwidth
y1=row * cellheight
x2=(col + 1) * cellwidth
y2=(row + 1) * cellheight
can.create_rectangle(col * cellwidth, row * cellheight, (col + 1) * cellwidth, (row + 1) * cellheight,
fill='white')
can.create_text(((x1+x2)/2,(y1+y2)/2),text='A')
window = Tk()
thecanvas = Canvas(window, width=500, height=500)
thecanvas.grid(row=0, column=0)
window.update_idletasks()
checkerboard(thecanvas)
window.mainloop()
The problem is that I want to add a previous line over the checkerboard, which does not belong to the grid layout. Something like this:
How can I achieve it?
Thanks in advance
You don't use grid to create checkoard, you use grid only to put canvas in window.
Canvas is in row=0 so you can put it in row=2 and then you can put Labels in row=0 and row=1
l1 = Label(window, text="I WANT TO CREATE THIS LABEL")
l1.grid(row=0, column=0)
l2 = Label(window, text="AND THIS TOO", fg='red')
l2.grid(row=1, column=0)
thecanvas = Canvas(window, width=500, height=500)
thecanvas.grid(row=2, column=0)
Full code
from tkinter import *
def checkerboard(can):
w = can.winfo_width()
h = can.winfo_height()
cellwidth = w / 4
cellheight = h / 4
for row in range(4):
for col in range(4):
x1=col * cellwidth
y1=row * cellheight
x2=(col + 1) * cellwidth
y2=(row + 1) * cellheight
can.create_rectangle(col * cellwidth, row * cellheight, (col + 1) * cellwidth, (row + 1) * cellheight,
fill='white')
can.create_text(((x1+x2)/2,(y1+y2)/2),text='A')
window = Tk()
l1 = Label(window, text="I WANT TO CREATE THIS LABEL")
l1.grid(row=0, column=0)
l2 = Label(window, text="AND THIS TOO", fg='red')
l2.grid(row=1, column=0)
thecanvas = Canvas(window, width=500, height=500)
thecanvas.grid(row=2, column=0)
window.update_idletasks()
checkerboard(thecanvas)
window.mainloop()
Instead of grid() you can even use pack() and you get the same result
l1 = Label(window, text="I WANT TO CREATE THIS LABEL")
l1.pack()
l2 = Label(window, text="AND THIS TOO", fg='red')
l2.pack()
thecanvas = Canvas(window, width=500, height=500)
thecanvas.pack()
If you really need to mix managers then you can also put Frame in row=0 and Canvas in row=1 and then you can use pack() inside Frame
frame = Frame(window)
frame.grid(row=0, column=0)
l1 = Label(frame, text="I WANT TO CREATE THIS LABEL")
l1.pack()
l2 = Label(frame, text="AND THIS TOO", fg='red')
l2.pack()
thecanvas = Canvas(window, width=500, height=500)
thecanvas.grid(row=1, column=0)
The best solution is to create a frame for the checkerboard, and then you can create the widgets in that frame. In the main window, you can use any geometry manager you want to add the checkerboard and any other widgets.
Though, in this specific case you can just move the canvas to row one and add anything else in row 0.
Related
I want this entry bar and other contents I'll add to the frame later to be centred correctly, I received this code that supposedly should work but it isn't.
import tkinter as tk
import math
import time
root = tk.Tk()
root.geometry()
root.attributes("-fullscreen", True)
exit_button = tk.Button(root, text = "Exit", command = root.destroy)
exit_button.place(x=1506, y=0)
frame = tk.Frame(root)
main_entry = tk.Entry(root, width = 100, fg = "black")
main_entry.place(x=50, y=50)
frame.place(relx=.5,rely=.5, anchor='center')
root.mainloop()
As you can see the frame isn't centred so how can I fix this?
In order to achieve widget centering on a fullscreen I've had to use grid manager.
The code below works but the exact positioning requires some fiddling with frame padding.
frame padx = w/2-300 and pady = h/2-45 are arbitrary values found using a bit of trial and error.
import tkinter as tk
root = tk.Tk()
root.attributes( '-fullscreen', True )
w, h = root.winfo_screenwidth(), root.winfo_screenheight()
frame = tk.Frame( root )
main_entry = tk.Entry( frame, width = 100 )
main_entry.grid( row = 0, column = 0, sticky = tk.NSEW )
frame.grid( row = 0, column = 0, padx = w/2-300, pady = h/2-45, sticky = tk.NSEW )
exit_button = tk.Button( frame, text = 'Exit', command = root.destroy )
exit_button.grid( row = 1, column = 0, sticky = tk.NSEW )
tk.mainloop()
Frame automatically changes size to size of objects inside Frame (when you use pack()) but you have nothing inside Frame. You put all widgets directly in root - so Frame has no size (width zero, height zero) and it is not visible.
When I use tk.Frame(root, bg='red', width=100, height=100) then I see small red frame in the center.
You have two problems:
(1) you put Entry in wrong parent - it has to be frame instead of root,
(2) you use place() which doesn't resize Frame to its children and it has size zero - so you don't see it. You would have to set size of Frame manully (ie. tk.Frame(..., width=100, height=100)) or you could use pack() and it will resize it automatically.
I add colors for backgrounds to see widgets. blue for window and red for frame.
import tkinter as tk
root = tk.Tk()
root['bg'] = 'blue'
root.attributes("-fullscreen", True)
exit_button = tk.Button(root, text="Exit", command=root.destroy)
exit_button.place(x=1506, y=0)
frame = tk.Frame(root, bg='red')
frame.place(relx=.5, rely=.5, anchor='center')
main_entry = tk.Entry(frame, width=100, fg="black")
main_entry.pack(padx=50, pady=50) # with external margins 50
root.mainloop()
I have two questions related to this attached code. This code is a part of my project in which i have to manage the attendance of 50 (or more) students.
When you will run this piece of code, you will see that there is a extra white space (that might be of the canvas) inside the Label Frame i.e. Attendance_Frame. All I wanted is that the there should be no extra white space and the scrollbar, instead of being at the extreme right, should be at the place where the labels end.
I have searched for the answer to my question and saw a similar case. But there, the person wanted the frame to expand to the canvas size. Link (Tkinter: How to get frame in canvas window to expand to the size of the canvas?).
But in my case, I want the canvas size to be equal to frame size (although the frame lies inside the canvas)
The other thing I want is that all the check boxes should initially be 'checked' (showing the present state) and when I uncheck random checkboxes (to mark the absent), and click the 'Submit' button (yet to be created at the bottom of the window), I should get a list with 'entered date' as first element and the roll numbers i.e. 2018-MC-XX as other elements. For example : ['01/08/2020', '2018-MC-7', '2018-MC-11', '2018-MC-23', '2018-MC-44'].
Actually my plan is when i will get a list i will easily write it to a text file.
from tkinter import *
from tkcalendar import DateEntry
root = Tk()
root.geometry('920x600+270+50')
root.minsize(920,600)
Attendance_frame = Frame(root) ### Consider it a Main Frame
Attendance_frame.pack()
attendaceBox = LabelFrame(Attendance_frame, text = 'Take Attendance', bd = 4, relief = GROOVE, labelanchor = 'n',font = 'Arial 10 bold', fg = 'navy blue', width = 850, height = 525) # A Label Frame inside the main frame
attendaceBox.pack_propagate(0)
attendaceBox.pack(pady = 15)
dateFrame = Frame(attendaceBox) # A small frame to accommodate date entry label & entry box
dateFrame.pack(anchor = 'w')
font = 'TkDefaultFont 10 bold'
date_label = Label(dateFrame, text = 'Enter Date : ', font = font).grid(row = 0, column = 0, sticky = 'w', padx = 10, pady = 10)
date_entry = DateEntry(dateFrame, date_pattern = 'dd/mm/yyyy', showweeknumbers = FALSE, showothermonthdays = FALSE)
date_entry.grid(row = 0, column = 1, sticky = 'w')
noteLabel = Label(attendaceBox, text = 'Note: Uncheck the boxes for absentees').pack(anchor = 'w', padx = 10, pady = 5)
canvas = Canvas(attendaceBox, borderwidth=0, background="#ffffff")
checkFrame = Frame(canvas, width = 100, height = 50)
vsb = Scrollbar(canvas, orient="vertical", command=canvas.yview)
canvas.configure(yscrollcommand=vsb.set)
vsb.pack(side="right", fill="y")
canvas.pack(side="left", fill="both", expand=True)
canvas.pack_propagate(0)
canvas.create_window((4,4), window=checkFrame, anchor="nw")
def onFrameConfigure(canvas):
'''Reset the scroll region to encompass the inner frame'''
canvas.configure(scrollregion=canvas.bbox("all"))
checkFrame.bind("<Configure>", lambda event, canvas=canvas: onFrameConfigure(canvas))
for i in range(0,51): # A loop to create Labels of students roll numbers & names
c = Checkbutton(checkFrame, text = f"{'2018-MC-'+str(i+1)} Student {i+1}")
c.grid(row = i, column = 0, padx = 10, sticky = 'w')
mainloop()
If you are creating a vertical list of items, you don't need to use a frame inside the canvas. The inner frame adds some unnecessary complexity. Instead, create the checkbuttons directly on the canvas with create_window.
You also need to configure the scrollregion attribute so that the scrollbar knows how much of the virtual canvas to scroll.
Finally, to have them selected you should assign a variable to each checkbutton, and make sure that the value is the proper value. By default checkbuttons use the values 0 and 1, so setting the variable to 1 will make it selected.
vars = []
for i in range(0,51):
var = IntVar(value=1)
vars.append(var)
x0, y0, x1, y1 = canvas.bbox("all") or (0,0,0,0)
c = Checkbutton(canvas, text = f"{'2018-MC-'+str(i+1)} Student {i+1}", variable=var)
canvas.create_window(2, y1+4, anchor="nw", window=c)
canvas.configure(scrollregion=canvas.bbox("all"))
Your all questions answer is here:
You should try this.
import tkinter as tk
from tkcalendar import DateEntry
root = tk.Tk()
root.geometry('920x600+270+50')
root.minsize(960, 600)
root.columnconfigure(0, weight=1)
root.rowconfigure(0, weight=1)
Attendance_frame = tk.Frame(root)
Attendance_frame.grid(row=0, column=0, sticky='nsew')
attendaceBox = tk.LabelFrame(Attendance_frame,
text='Take Attendance',
bd=4,
relief='groove',
labelanchor='n',
font='Arial 10 bold',
fg='navy blue',
width=850,
height=525)
attendaceBox.grid(row=0, column=0, sticky='nsew', padx=15)
Attendance_frame.columnconfigure(0, weight=1)
Attendance_frame.rowconfigure(0,weight=1)
dateFrame = tk.Frame(attendaceBox) # A small frame to accommodate date entry label & entry box
dateFrame.grid(row=0, column=0, sticky='nsew')
font = 'TkDefaultFont 10 bold'
date_label = tk.Label(dateFrame, text='Enter Date : ', font=font)
date_label.grid(row=0, column=0, sticky='w', padx=10, pady=10)
date_entry = DateEntry(dateFrame, date_pattern='dd/mm/yyyy', showweeknumbers=False, showothermonthdays=False)
date_entry.grid(row=0, column=1, sticky='w')
noteLabel = tk.Label(attendaceBox, text='Note: Uncheck the boxes for absentees', anchor='w')
noteLabel.grid(row=1, column=0, sticky='nsew')
attendaceBox.rowconfigure(2, weight=1)
canvas = tk.Canvas(attendaceBox, width=200, borderwidth=0, background="#ffffff")
# You can set width of canvas according to your need
canvas.grid(row=2, column=0, sticky='nsew')
canvas.columnconfigure(0, weight=1)
canvas.rowconfigure(0, weight=1)
vsb = tk.Scrollbar(attendaceBox, orient="vertical", command=canvas.yview)
vsb.grid(row=2, column=1, sticky='nsew')
canvas.configure(yscrollcommand=vsb.set)
checkFrame = tk.Frame(canvas, bg='green')
canvas.create_window((0, 0), window=checkFrame, anchor="nw", tags='expand')
checkFrame.columnconfigure(0, weight=1)
for i in range(0, 51): # A loop to create Labels of students roll numbers & names
c = tk.Checkbutton(checkFrame, anchor='w', text=f"{'2018-MC-' + str(i + 1)} Student {i + 1}")
c.grid(row=i, column=0, sticky='nsew')
c.select()
canvas.bind('<Configure>', lambda event: canvas.itemconfigure('expand', width=event.width))
checkFrame.update_idletasks()
canvas.config(scrollregion=canvas.bbox('all'))
root.mainloop()
Get Selected Value
vars = []
for i in range(0, 51): # A loop to create Labels of students roll numbers & names
var = tk.IntVar()
c = tk.Checkbutton(checkFrame,
variable=var,
anchor='w', text=f"{'2018-MC-' + str(i + 1)} Student {i + 1}")
c.grid(row=i, column=0, sticky='nsew')
c.select()
vars.append(var)
def state():
print(list(map((lambda var: var.get()), vars)))
I have some problem making scrollbar on grid. Most codes use pack and I never really used canvas but I think I have to somehow include it. I am quite new to programming.Thank you for any help.
tkinter import *
class test():
def add_label(self, name, row, column):
return Label(self.master, text=name, width=11, height=1, borderwidth=1, relief="groove",
font=("Helvetica", 12), fg="black",
bg="white", ).grid(row=row, column=column, sticky='nesw')
def __init__(self, master):
# constructor
self.master = master
for x in range(6):
for y in range(21):
Grid.columnconfigure(master, x, weight=1)
Grid.rowconfigure(master, y, weight=1)
master.title("Emotion test")
master.geometry('1100x500')
master.iconbitmap(r'emotion test icon.ico')
master.minsize(1100, 500)
root = Tk()
obj = test(root)
root.mainloop()
Welp, here is a scroll bar example I found via quick google search:
from Tkinter import *
root = Tk()
scrollbar = Scrollbar(root)
scrollbar.pack( side = RIGHT, fill = Y )
mylist = Listbox(root, yscrollcommand = scrollbar.set )
for line in range(100):
mylist.insert(END, "This is line number " + str(line))
mylist.pack( side = LEFT, fill = BOTH )
scrollbar.config( command = mylist.yview )
mainloop()
I took it form here: https://www.tutorialspoint.com/python/tk_scrollbar.htm
In this code, entering an integer and clicking the process button shows a number of entry boxes. I want the back button to act as a reverting button which makes the entry boxes disappear and bring the GUI to its original state. How can I do this?
import tkinter as tk
import tkinter.ttk as ttk
hht=[]
tks = []
window = tk.Tk()
def open_window(pll):
numh = int(pll)
l0 = tk.Label(canvas, text="H T", font="Calibri 12", bg="white")
canvas.create_window(390,125, window=l0, anchor=tk.NW)
for i in range(numh):
hht.append(tk.StringVar())
tks.append(tk.StringVar())
en = ttk.Entry(canvas, textvariable = hht[i])
en.config({"background": "gainsboro"})
canvas.create_window(350, 150+i*25, window=en, anchor=tk.NW)
aen = ttk.Entry(canvas, textvariable = tks[i])
aen.config({"background": "gainsboro"})
canvas.create_window(500, 150+i*25, window=aen, anchor=tk.NW)
ws = window.winfo_screenwidth()
hs = window.winfo_screenheight()
w = 700 # width for the Tk root
h = 410 # height for the Tk root
x = (ws / 2) - (w / 2)
y = (hs / 2) - (h / 2)
window.geometry('%dx%d+%d+%d' % (w, h, x, y))
canvas = tk.Canvas(window,bg="white",width=700, height=410, highlightthickness=0)
canvas.pack()
l13= tk.Label(canvas, text="Enter Numbers", font="Calibri 16", bg="white")
canvas.create_window(300,8, window=l13, anchor=tk.NW)
l0 = tk.Label(canvas, text="Entry", font="Calibri 12", bg="white")
canvas.create_window(15,58, window=l0, anchor=tk.NW)
PLz = tk.DoubleVar()
entry_PLz = ttk.Entry(canvas, textvariable=PLz)
entry_PLz.config({"background": "gainsboro"})
canvas.create_window(270,70, window=entry_PLz)
submit_button = ttk.Button(canvas, text="Process >>", command=lambda: open_window(PLz.get()))
canvas.create_window(300, 100, window=submit_button, anchor=tk.NW)
back_button = ttk.Button(canvas, text="Back")
canvas.create_window(450, 100, window=back_button, anchor=tk.NW)
window.resizable(False, False)
window.mainloop()
So I finally decided to build a GUI, but I'm stuck bad, and I can't find anything on the internet.
What I'm trying to acomplish is basically the "freeze panes" option from Excel.
I have build a scrollable grid of labels following this guide. But I want the header of the initial grid to stay when I scroll.
I have thought of making a separate grid and place the header in it, but I can't anything other than (0,0,0,0) from bbox (to place them right, because the header might be short while the entries might be long!).
As an alternative to bbox I have thought of "expanding" the titles with something like
title+' '*(len(longest_entry)-len(title)), but that seems highly inefficient if the entry list is huge and probably won't look as pretty if my entry is something like |||||| or WWWWWW due to different size of the characters.
Can you help me with bbox in this case? (what should I use it on?)
Or give me totally different ideas of what to do?
Many thanks in advance!
Sorry for using the deprecated tag header, but I couldn't find an appropiate tag
This is a GUI I'm working on for my tasks list with priority and description that works pretty well. The entry boxes and headers are on separate canvases so that the header will not scroll and the entry boxes will. I had trouble aligning the headers with the entries. The short term fix was to use different fonts that happen to align. I still don't know why explicitly setting widths did not work.
import Tkinter as Tk
from Tkinter import StringVar
#-----------------------------------------------------------------------------
# Scroll entry boxes with mouse wheel
# canvas1, frame1
#
# Header row is on a separate canvas and will not scroll with entry boxes.
# canvas2, frame2
#
# Could not align header and entries unless different fonts were used.
# Play with variable "font_choice" to see how it works
#-----------------------------------------------------------------------------
# define fonts and other preliminary things
font_choice = 1
if(font_choice == 1): # using same font sizes does not align well
Label_Font = "Arial 10"
Entry_Font = "Arial 10"
if(font_choice == 2): # using different font sizes not exactly aligned, but close
Label_Font = "Arial 9 bold"
Entry_Font = "Arial 10"
if(font_choice == 3): # this does not align well
Label_Font = "Helvetica 10"
Entry_Font = "Helvetica 10"
if(font_choice == 4): # this aligns pretty well (surprisingly)
Label_Font = "Helvetica 14"
Entry_Font = "Helvetica 14"
width_priority = 10
width_time_estimate = 15
width_description_1 = 90
Labels = ["Priority", "Time Est. (mins)", "Description 1"]
Widths = [width_priority, width_time_estimate, width_description_1]
Label_Colors = ["misty rose", "lavender", "lightcoral"]
list_length = 25
canvas_width = 1300
header_height = 25
#------------------------------------------------------------------------------
def populate1(framex):
global entrys_1
global entrys_2
global entrys_3
label_flag = 0 # 1 or 2 are options, 0 is off
ijk_col = 0
if(label_flag == 1):
Tk.Label(framex, text=Labels[ijk_col]).grid(row=0, column=ijk_col)
if(label_flag== 2):
xy1 = Tk.Label(framex, text=Labels[ijk_col], font=Label_Font)
xy1.grid(row=0, column=ijk_col)
xy1.config(width=Widths[ijk_col], borderwidth="1", background=Label_Colors[ijk_col])
entrys_1 = []
variables_1 = []
ii = 0
for row in range(list_length):
rowx = row + 1
variables_1.append(StringVar())
entrys_1.append(Tk.Entry(framex, textvariable=variables_1[ii], font=Entry_Font))
entrys_1[-1].config(width=Widths[ijk_col], borderwidth="1")
entrys_1[-1].grid(row=rowx, column=ijk_col)
entrys_1[-1].config(fg="black", bg=Label_Colors[ijk_col])
entrys_1[-1].delete(0, Tk.END)
entrys_1[-1].insert(0, "Placeholder")
ii += 1
ijk_col = 1
if(label_flag == 1):
Tk.Label(framex, text=Labels[ijk_col]).grid(row=0, column=ijk_col)
if(label_flag== 2):
xy2 = Tk.Label(framex, text=Labels[ijk_col], font=Label_Font)
xy2.grid(row=0, column=ijk_col)
xy2.config(width=Widths[ijk_col], borderwidth="1", background=Label_Colors[ijk_col])
entrys_2 = []
variables_2 = []
ii = 0
for row in range(list_length):
rowx = row + 1
variables_2.append(StringVar())
entrys_2.append(Tk.Entry(framex, textvariable=variables_2[ii], font=Entry_Font))
entrys_2[-1].config(width=Widths[ijk_col], borderwidth="1")
entrys_2[-1].grid(row=rowx, column=ijk_col)
entrys_2[-1].config(fg="black", bg=Label_Colors[ijk_col])
entrys_2[-1].delete(0, Tk.END)
entrys_2[-1].insert(0, "Placeholder")
ii += 1
ijk_col = 2
if(label_flag == 1):
Tk.Label(framex, text=Labels[ijk_col]).grid(row=0, column=ijk_col)
if(label_flag== 2):
xy3 = Tk.Label(framex, text=Labels[ijk_col], font=Label_Font)
xy3.grid(row=0, column=ijk_col)
xy3.config(width=Widths[ijk_col], borderwidth="1", background=Label_Colors[ijk_col])
entrys_3 = []
variables_3 = []
ii = 0
for row in range(list_length):
rowx = row + 1
variables_3.append(StringVar())
entrys_3.append(Tk.Entry(framex, textvariable=variables_3[ii], font=Entry_Font))
entrys_3[-1].config(width=Widths[ijk_col], borderwidth="1")
entrys_3[-1].grid(row=rowx, column=ijk_col)
entrys_3[-1].config(fg="black", bg=Label_Colors[ijk_col])
entrys_3[-1].delete(0, Tk.END)
entrys_3[-1].insert(0, "Placeholder")
ii += 1
def onFrameConfigure(canvas):
'''Reset the scroll region to encompass the inner frame'''
canvas.configure(scrollregion=canvas.bbox("all"))
#-----------------------------------------------------------------------------
root = Tk.Tk()
root.title("StackOverflow_Label_Entry_Align")
#---------------------------------
# set up canvas that scrolls for entries, header on separate canvas that does not scroll
canvas1 = Tk.Canvas(root, borderwidth=0, background="#ffffff", height=400, width=canvas_width)
frame1 = Tk.Frame(canvas1, background="#ffffff")
xscrollbar = Tk.Scrollbar(root, orient=Tk.HORIZONTAL, command=canvas1.xview)
yscrollbar = Tk.Scrollbar(root, orient=Tk.VERTICAL, command=canvas1.yview)
yscrollbar.pack(side=Tk.RIGHT, fill=Tk.Y)
xscrollbar.pack(side=Tk.BOTTOM, fill=Tk.X)
canvas1.configure(xscrollcommand=xscrollbar.set)
canvas1.configure(yscrollcommand=yscrollbar.set)
canvas1.pack(side="bottom", fill="both", expand=True)
canvas1.create_window((4,4), window=frame1, anchor="nw")
frame1.bind("<Configure>", lambda event, canvas=canvas1: onFrameConfigure(canvas))
def _on_mousewheel(event):
canvas1.yview_scroll(-1*(event.delta/120), "units")
canvas1.configure(yscrollincrement='20') # adjust sensitivity
canvas1.bind_all("<MouseWheel>", _on_mousewheel) # Oakley has a post on this
canvas1.focus_set() # key to making canvas bind to left, right keys
#-----------------------------------------------------------------------------
# set up separate canvas for header row that will not scroll
canvas2 = Tk.Canvas(root, borderwidth=0, background="#ffffff", height=header_height, width=canvas_width)
frame2 = Tk.Frame(canvas2, background="#ffffff")
canvas2.pack(side="top", fill="both", expand=True)
canvas2.create_window((0,0), window=frame2, anchor="nw", height=header_height)
x1 = Tk.Label(frame2, text=Labels[0], font=Label_Font)
x1.grid(row=0, column=0)
x1.config(width=Widths[0], borderwidth="1", background=Label_Colors[0])
x2 = Tk.Label(frame2, text=Labels[1], font=Label_Font)
x2.grid(row=0, column=1)
x2.config(width=Widths[1], borderwidth="1", background=Label_Colors[1])
x3 = Tk.Label(frame2, text=Labels[2], font=Label_Font)
x3.grid(row=0, column=2)
x3.config(width=Widths[2], borderwidth="1", background=Label_Colors[2])
#-----------------------------------------------------------------------------
populate1(frame1) # add entry boxes
#-----------------------------------------------------------------------------
root.mainloop()
#-----------------------------------------------------------------------------