Position the button in right place Tkinter

Viewed 260

How can I position the two button close to eachother. I am getting the output as shown in the picture below.

 _scrape_btn = ttk.Button(_mainframe, text='Scrape!', command=save)
 _scrape_btn.grid(row=2, column=0)

 _compress_btn = ttk.Button(_mainframe, text='Compress!', command=compress)
 _compress_btn.grid(row=2, column=1)

enter image description here

1 Answers

Looking at your image, I can tell that your URL and Content LabelFrames have been put into row=0, column=0 and row=1, column=0 respectively. So you should now realise that the width of the first column is as large as the labelframe. Hence your 2nd button starts where the 1st column ends since it on the 2nd column.

What you can do is add columnspan=2 in both the labelFrames.

Now by default the buttons will be center aligned. To bring them close together, you need to add sticky='e' in the grid command of the 1st button (Scrape) and sticky='w' in the grid command of the 2nd button (Compress).

Related