首页 新闻 会员 周边

🔔【重金悬赏】Tkinter Label 组件中的 justify 与 anchor 的区别是什么啊?🔔

0
悬赏园豆:80 [待解决问题]

ヾ(≧▽≦)o!!!!!🌹求求了进来看看吧🌹!!!!!ヾ(≧▽≦)o
最近一直在死磕写 Tkinter 遇到的一些问题。
刚刚写一个小程序的时候发现我没有成功写出那个功能,便又测试了一下这段代码,没有弄清楚里面的原理。

import tkinter
root = tkinter.Tk()
root.configure(bg='black')
lb1 = tkinter.Label(root, text='lb1')
lb1 = tkinter.Label(root, text='lb1\nmy name is lb1', width=20)
lb1.grid(row=0, column=0)
lb2 = tkinter.Label(root, text='lb2\nmy name is lb2', width=20, anchor='w')
lb2.grid(row=1, column=0)
lb3 = tkinter.Label(root, text='lb3\nmy name is lb3', width=20, anchor='w', justify='left')
lb3.grid(row=2, column=0)
lb4 = tkinter.Label(root, text='lb4\nmy name is lb4', width=20, justify='left')
lb4.grid(row=3, column=0, sticky='nswe')
root.grid_columnconfigure(0, weight=1)
root.mainloop()

这样写起来为什么又会是这样的结果呢?anchor 和 justify 的区别是什么呢?🤔

黎明前的霓虹的主页 黎明前的霓虹 | 初学一级 | 园豆:122
提问于:2021-08-13 15:35
< >
分享
所有回答(1)
0

简书:https://www.jianshu.com/p/c5de127fbb2d
CSDN:https://blog.csdn.net/u011878611/article/details/104134616
我看别人图文并茂,写的很清晰呀

〆灬丶 | 园豆:2287 (老鸟四级) | 2021-08-13 16:44

谢谢谢谢!

支持(0) 反对(0) 黎明前的霓虹 | 园豆:122 (初学一级) | 2021-08-13 17:34
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册