我可以在不中断代码执行顺序的情况下,在python中打开一个用于打印调试信息的shell窗口吗?
例如:
def foo(b):
print b
for a in range(0, 100):
print a # normally this will be used for on-the-fly simple debugging purpose
# and will mess the console output of foo()
foo(a)我可以这样做吗:
newshell = <new cmd.exe or bash>
for a in range(0, 100):
newshell.print(a) # information will be printed to new opened shell
foo(a)提前谢谢。
发布于 2013-12-17 22:11:45
您可以:
看到正确的数字)
发布于 2016-09-12 14:18:31
我们不仅仅需要一个shell来打印一些东西。您可以使用Tkinter Text widget
from Tkinter import Tk, Text, END
root = Tk()
text = Text(root)
text.pack()
def foo(b):
print b
for a in range(0, 100):
text.insert(END, str(a)+"\n")
text.see(END)
text.update()
foo(a)
text.wait_window() # wait until we close the windowhttps://stackoverflow.com/questions/20636249
复制相似问题