python messagebox showinfo用法_Tkinter python中的tkMessageBox.showinfo中的for循环 - python

我想在python的for tkMessageBox.showinfo()中实现Tkinter循环

我需要在框中打印一个list of lists。

我目前拥有的是:

tkMessageBox.showinfo(

"Help INFORMATION",

"help1 help2 \n help3 help4 \n help5 help6"

)

我想要的是:

像下面这样。

my_list=[['help1','help2'],['help3','help4'],['help5','help6']]

tkMessageBox.showinfo(

"Help INFORMATION",

for i in my_list:

i + "\n" #cant use print as I want to display it in the dialog box and not in the console.

)

这样对话框中的输出应如下所示:

help1 help2

help3 help4

help5 help6

但是我得到的是:

Syntax Error -> for i in my_list:

python大神给出的解决方案

这个怎么样:

my_list=[['help1','help2'],['help3','help4'],['help5','help6']]

tkMessageBox.showinfo(

"Help INFORMATION",

'\n'.join(map(' '.join, my_list))

)

我没有测试它,但理想情况下应该完成这项工作。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值