0

My code is as follows: Code

but = Button(root, text="Translate!", command= lambda : gtrans(tren.get()))
but.grid(row=2, column=2, padx=5, pady=5)
but2 = Button(root, text="Clear", command = lambda: reset())
but2.grid(row=2, column=3, padx=5, pady=5)

And my output is as follows: This is what appears when i extend a 300x300 window

Please Help

  • 2
    [Did you check this](https://stackoverflow.com/questions/39555194/how-to-add-space-between-two-widgets-placed-in-grid-in-tkinter-python) – JenilDave Jun 28 '20 at 15:17
  • 2
    Please describe what you expect. Do you want the buttons further apart? Closer together? It's not clear what you want changed. – Bryan Oakley Jun 28 '20 at 15:22

1 Answers1

0

If you follow your pastebin, you can see that both your label and entry are also in col = 2 (i.e. same as 'Translate!' button). So the issue is not a big gap between columns(the gap between Entry window and the 'Clear' button is rather small). The issue is the width of col2 is fitting your label.

What you could do:

  • Add columnspan = 2 to both Entry and Label (thus these elements will span over column 2 and column 3) as lab.grid(row=0, column=2, columnspan = 2) and tren.grid(row=1, column=2, columnspan = 2)
  • Following this answer you could add sticky = 'E' on your
    'Translate!' button to move it to the right edge of column 2, thus
    reducing gap between the two buttons (I'm not sure if it would look
    the best, but it depends how you want it to be)
dm2
  • 4,053
  • 3
  • 17
  • 28