Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Tkinter按钮与网格对齐_Python_Python 3.x_Tkinter - Fatal编程技术网

Python Tkinter按钮与网格对齐

Python Tkinter按钮与网格对齐,python,python-3.x,tkinter,Python,Python 3.x,Tkinter,我想将tkinter按钮向左对齐,但找不到任何帮助 addButton=按钮(根、, text=“添加费用”, bg='red', fg='白色', 命令=addButtonDef, 字体=(“Arial窄字体”,32)) addButton.grid(行=1,列=0) 有关于如何调整的解决方案吗?仅使用网格?您是否尝试过sticky,它表示西部为“W” addButton.grid(sticky="W", row=1, column=0) 或者,您可以尝试按钮小部件中的anchor=“w”

我想将tkinter按钮向左对齐,但找不到任何帮助

addButton=按钮(根、,
text=“添加费用”,
bg='red',
fg='白色',
命令=addButtonDef,
字体=(“Arial窄字体”,32))
addButton.grid(行=1,列=0)

有关于如何调整的解决方案吗?仅使用网格?

您是否尝试过sticky,它表示西部为“W”

addButton.grid(sticky="W", row=1, column=0)
或者,您可以尝试按钮小部件中的anchor=“w”

addButton = Button(root,
                   anchor="w"...)

你试过sticky吗?它代表west的W

addButton.grid(sticky="W", row=1, column=0)
或者,您可以尝试按钮小部件中的anchor=“w”

addButton = Button(root,
                   anchor="w"...)
阅读有关使用的选项阅读有关使用的选项