【发布时间】:2022-12-27 22:37:10
【问题描述】:
I want to aling dynamicaly 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 alinged 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 alinged from the right side.
I need to have these on grid. Anyone have any idea how to aling only button and text to left while expanding entire widget at the same time?
【问题讨论】:
标签: tkinter grid sticky tkinter.checkbutton