我有以下按钮:
option1=tkinter.Button(opt1,text='this is a test to see how many words we can fit in a button and stuff so heres some more words',width=49,height=3,bg='grey',)
Run Code Online (Sandbox Code Playgroud)
这使得一个按钮有了单词see how many words we can fit in a button and stuff so heres som
.
我希望文本向下移动到下一行而不是从按钮的一侧移开.
另外,我怎样才能使文本不居中呢?
python 3.3.3.
使用该wraplength
选项是使其换行的好方法,并且justify
可以选择执行除中心以外的操作:
option1 = tkinter.Button(opt1, wraplength=80, justify=LEFT, text='This is the text')
Run Code Online (Sandbox Code Playgroud)
值的wraplength
大小以屏幕为单位或像素为单位.您也可以将'\n'
字符拖放到字符串的中间以手动断开该行,但如果执行此操作,也可能必须手动调整按钮的大小.
归档时间: |
|
查看次数: |
3802 次 |
最近记录: |