python-如何将ttk中的checkbutton对齐到左侧
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了python-如何将ttk中的checkbutton对齐到左侧,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含1307字,纯文字阅读大概需要2分钟。
内容图文
![python-如何将ttk中的checkbutton对齐到左侧](/upload/InfoBanner/zyjiaocheng/667/df0d233342bb46dc88d00c2ebc45bdf5.jpg)
我想配置tkinter.ttk.Checkbutton的stylestyle.configure(‘TCheckbutton’,background = theme,前景=’white’,anchor = tkinter.W)以将该检查按钮向左对齐,因为现在它位于中心.非常感谢每个答案:)
解决方法:
您的问题还不清楚.
这是一些代码,用于说明左,右,无分配的数据包以及锚点e,w和无分配的信号.
这应该使您更好地了解如何使用pack vs锚以及何时使用它.
from tkinter import *
import tkinter.ttk as ttk
root = Tk()
packLabel = Label(root)
packLabel.pack(side = LEFT)
packLabel.config(text = "Packed LEFT")
pack2Label = Label(root)
pack2Label.pack()
pack2Label.config(text = "no Pack side")
pack3Label = Label(root)
pack3Label.pack(side = RIGHT)
pack3Label.config(text = "Packed RIGHT")
anchorLabel = ttk.Label(root,width = 50, background = "green", anchor = 'e')
anchorLabel.pack(side = BOTTOM)
anchorLabel.config(text = "anchor = 'e'")
anchor2Label = Label(root,width = 50, background = "orange", anchor = 'w')
anchor2Label.pack(side = BOTTOM)
anchor2Label.config(text = "anchor = 'w'")
anchor3Label = Label(root,width = 50, background = "black", fg = "white")
anchor3Label.pack(side = BOTTOM)
anchor3Label.config(text = "no anchor while packed BOTTOM")
checkButton = ttk.Checkbutton(root)
checkButton.config(text = "Checkbutton anchor = 'w'")
checkButton.pack(anchor = "w") # anchor the pack for ttk.
root.mainloop()
生成的程序应如下所示:
内容总结
以上是互联网集市为您收集整理的python-如何将ttk中的checkbutton对齐到左侧全部内容,希望文章能够帮你解决python-如何将ttk中的checkbutton对齐到左侧所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。