微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

对齐 tkinter 中多行复选按钮第一行上的复选框

如何解决对齐 tkinter 中多行复选按钮第一行上的复选框

我正在尝试使用滚动条在复选按钮上获取多行文本,如下面的屏幕截图所示。 你会注意到复选框没有正确地左对齐,我在这里使用了 pack 方法,有没有关于如何改进这一点的建议,我还想在文本的第一行显示复选按钮而不是中间,任何帮助将不胜感激。

enter image description here

Frame5 = Frame(self.root,bd=5,relief=RIDGE,bg="white") 
        Frame5.place(x=10,y=400,width=750,height=290)

mycanvas = Canvas(Frame5)
mycanvas.pack(side=LEFT,fill="both",expand="yes")

yscrollbar = Scrollbar(Frame5,orient=VERTICAL,command=mycanvas.yview)
yscrollbar.pack(side=RIGHT,fill = "y")

mycanvas.configure(yscrollcommand=yscrollbar.set)

mycanvas.bind('<Configure>',lambda e: mycanvas.configure(scrollregion=mycanvas.bBox('all')))

myframe = Frame(mycanvas)
mycanvas.create_window((0,0),window=myframe,anchor="nw")

checkBox1=Checkbutton(myframe,wraplength=700,justify=LEFT,text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,when an unkNown printer took a galley of type and scrambled it to make a type specimen book.",font=("times new roman",15),fg="black").pack()
checkBox2=Checkbutton(myframe,text="It has survived not only five centuries,but also the leap into electronic typesetting,remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages,and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",fg="black").pack()
checkBox3=Checkbutton(myframe,text="There are many variations of passages of Lorem Ipsum available,but the majority have suffered alteration in some form,by injected humour,or randomised words which don't look even slightly believable.",fg="black").pack()
checkBox4=Checkbutton(myframe,text="The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from de Finibus Bonorum et Malorum by Cicero are also reproduced in their exact original form,accompanied by English versions from the 1914 translation by H. Rackham.",fg="black").pack()```

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。