我是靠谱客的博主 超级寒风,这篇文章主要介绍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))

)

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

最后

以上就是超级寒风最近收集整理的关于python messagebox showinfo用法_Tkinter python中的tkMessageBox.showinfo中的for循环 - python的全部内容,更多相关python内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(49)

评论列表共有 0 条评论

立即
投稿
返回
顶部