I want to align dynamically created Tkinter Checkbuttons to left while having widgets added by grid with sticky="EW"
at the same time. I also want to display a background color. Here is code and example of such case but where widgets are not aligned to left:
from tkinter import *
root = Tk()
row = 0
check_buttons = []
for i in range(10):
text = str(i)*row
check = Checkbutton(root, text=text)
check.grid(row=row, sticky="WE")
row += 1
check.config(bg="green")
root.mainloop()
Here is another example where sticky="W"
is used instead. Problem is that widget borders are not aligned from the right side.
I need to have these on grid. Anyone have any idea how to align only button and text to left while expanding entire widget at the same time?
Edit: Forgotten to add parameter in CheckButton.
You don't needed do this
config
when on fly. Just added in line 9bg='green'