Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/333.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/16.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_Tkinter Label - Fatal编程技术网

Python 如何在Tkinter中将底部标签移到最右边?

Python 如何在Tkinter中将底部标签移到最右边?,python,python-3.x,tkinter,tkinter-label,Python,Python 3.x,Tkinter,Tkinter Label,这是我的代码片段 footer_frame = tk.Frame() tk.Label(footer_frame, text = 'by .....', font = 'arial 10', padx=5, pady=5).pack(side = tk.RIGHT, anchor='se') footer_frame.pack(tk.BOTTOM) 要将标签一直放在页脚内的右侧,最简单的方法是使用pack并告诉标签在右侧 由于底部没有footer\u frame填充,因此默认情况下它将居中。由

这是我的代码片段

footer_frame = tk.Frame()
tk.Label(footer_frame, text = 'by .....', font = 'arial 10', padx=5, pady=5).pack(side = tk.RIGHT, anchor='se')
footer_frame.pack(tk.BOTTOM)

要将标签一直放在页脚内的右侧,最简单的方法是使用
pack
并告诉标签在右侧

由于底部没有
footer\u frame
填充,因此默认情况下它将居中。由于框架会收缩以适应其内容,因此标签也会居中显示

下面是一个示例,它使用
side='right'
作为标签,使用
fill='x'
作为页脚框架。我给了标签一个独特的颜色,这样你就可以看到它与窗户和框架的关系

import tkinter as tk

root = tk.Tk()
root.geometry("400x200")
footer_frame = tk.Frame(root)
label = tk.Label(footer_frame, text="by .....", background="bisque")

footer_frame.pack(side="bottom", fill="x")
label.pack(side="right")

root.mainloop()

要移动整个标签还是仅移动标签的文本?你试过把标签包装在右边吗?@BryanOakley如何把它包装到右边?它是什么?你的答案并不比这个问题更清楚。您希望实际的标签小部件位于右侧,还是希望小部件填充底部,但文本位于右侧?再说一次,如果你想把它放在右边,你试过把它放在右边吗?我想把标签部件移到右边。我尝试使用side=tk将其打包到右侧。对,它不起作用,因为您没有展开页脚以填充所有水平空间。Thx mate获取帮助:)