对齐 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 (将#修改为@)