0

Hello everyone
How can i make the button be on the left side or right side please
Part of the code

Button(self, text = "start", command = self.launch).grid(row = 7, column = 0, columnspan = 1,)

Thanks in advance

4
Contributors
3
Replies
25
Views
4 Years
Discussion Span
Last Post by bumsfeld
0

You can also use the stick attribute

Button(self,text="Start",command=self.launch).grid(row = 7, column = 0, columnspan = 1, sticky=E)

But sticky attribute can be really messy. Just experiment with the positioning. Other values for sticky are N and W and S. You can also use them in combination

0

You could potentially us a label as a spacer:

try:
    # Python2
    import Tkinter as tk
except ImportError:
    # Python3
    import tkinter as tk

root = tk.Tk()
root['bg'] = 'yellow'

# use label as spacer, match background color
spacer = tk.Label(root, width=20, bg='yellow')
spacer.grid(row=1, column=1)

button = tk.Button(root, text="Button1")
# puts button to the right of label spacer
button.grid(row=1, column=2)

root.mainloop()
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.