多行Tkinter按钮?

The*_*dxo 1 python tkinter

我有以下按钮:

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.

Cro*_*man 6

使用该wraplength选项是使其换行的好方法,并且justify可以选择执行除中心以外的操作:

option1 = tkinter.Button(opt1, wraplength=80, justify=LEFT, text='This is the text')
Run Code Online (Sandbox Code Playgroud)

值的wraplength大小以屏幕为单位或像素为单位.您也可以将'\n'字符拖放到字符串的中间以手动断开该行,但如果执行此操作,也可能必须手动调整按钮的大小.