How to center this Entry widget?
Question: I am starting a project in Python: an email client. I know it may sound odd,
but it's just for fun.

I have an `Entry` widget and a `Canvas` widget. When I `pack` them both, It
gives me the Canvas, and an Entry widget centred above the Canvas, with a
border around the Canvas, therefore a border separating the Entry widget and
the Canvas.

What I want is the Entry widget centred in the Canvas, with no borders
dividing the Entry box and the Canvas.

When I set the master widget in the Entry widget to `canvas`, that canvas
doesn't appear: only the Entry widget, with the window large enough only to
contain the Entry widget.

If the master widget is set to `frame`, I get what I described above, the
canvas and Entry widget separate, but the size of the whole window is as
specifies.

This is my actual code:

    
    
    import tkinter
    
    frame = tkinter.Tk()
    frame.config(height=370, width=670, bg="#C2C2D6")
    
    entry = tkinter.Entry(frame, exportselection=0)
    canvas = tkinter.Canvas(frame, height=370, width=670, bg="#C2C2D6", 
                            bd=0, relief="sunken")
    entry.pack()
    canvas.pack()
    
    frame.mainloop()
    


Answer: You do not need `Canvas`. You can set `frame` as the parent of `entry`:

    
    
    import tkinter
    
    frame = tkinter.Tk()
    
    frame.config(height=370, width=670, bg="#C2C2D6")
    entry = tkinter.Entry(frame, exportselection=0)
    entry.pack(padx=100, pady=100, expand=1, fill='x')
    
    frame.mainloop()
    

