TA的每日心情 | 慵懒 2019-2-26 22:32 |
---|
签到天数: 1 天 连续签到: 1 天 [LV.1]测试小兵
|
本帖最后由 bilibili鹅 于 2019-11-27 14:31 编辑
1.新建一个gui窗口
- from tkinter import *
- root = Tk()
- text = Text(root,width=200,height=150)
- text.pack()
- root.mainloop()
复制代码
2.测试函数
- import logging
- from time import sleep
- def test():
- for i in range(50):
- logging.info('test log %d'%i)
- sleep(1)
- pr = logging.StreamHandler()
- logging.basicConfig(level=logging.INFO, handlers=[pr, ],
- format="%(asctime)s,%(name)s,%(levelname)s : %(message)s"
- )
- if __name__ == '__main__':
- test()
复制代码
3.求大佬指导如何运行GUI时,logging中打印一条日志,Text控件中就显示一条
|
|