简体   繁体   English

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

[英]Python Tkinter message box with multiple text

http://i.imgur.com/0dLxzzc.png http://i.imgur.com/0dLxzzc.png
How can I make the text on the right hand side( stored in variable msg2 ) to start from the top, ie same horizontal level as message on left hand side( msg ) Here is my code 如何使右侧的文本( 存储在变量 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()

Use sticky option (See grid documentation ): 使用sticky选项(请参阅grid文档 ):

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM