带有多个文本的Python Tkinter消息框

时间:2014-02-22 15:07:46

标签: python python-2.7 tkinter

http://i.imgur.com/0dLxzzc.png
如何使文本在右侧(存储在变量 msg2 )从顶部开始,即与左侧消息相同的水平级别( MSG ) 这是我的代码

from Tkinter import *
top = Tk()
msg = """I very soon decided that until I had done something towards naming and describing the most important groups in my collection, and had worked out some of the more interesting problems of variation and geographical distribution (of which I had had glimpses while collecting them), I would not attempt to publish my travels.GoodBye!!"""
w= Message(top,text=msg)
msg2="""I feel bound to give them full satisfaction on this point"""
v= Message(top,text=msg2)
w.grid(row=0,column=0)
v.grid(column=1,row=0)

top.mainloop()

1 个答案:

答案 0 :(得分:1)

使用sticky选项(请参阅grid documentation):

w.grid(row=0, column=0, sticky=N)
v.grid(row=0, column=1, sticky=N)