小编Mar*_*ria的帖子

在线程中使用while循环时出现wxPython Pango错误

在这个程序中,当我在线程中使用while循环时出现错误.没有循环我没有错误.当然在实际程序中我不会连续更新标签.知道我做错了什么吗?

这是该计划:

import wx
import thread

class Example(wx.Frame):

    def __init__(self, parent): 
        wx.Frame.__init__(self,parent)
        self.InitUI()

    def InitUI(self):
        self.SetSize((250, 200))
        self.Show(True)

        self.text = wx.StaticText(self, label='',pos=(20,30))

        thread.start_new_thread(self.watch,(self,None))

    def watch(self,dummy,e):
        while True:
            self.text.SetLabel('Closed')


def main():
    ex = wx.App()
    Example(None)
    ex.MainLoop()    

if __name__ == '__main__':
    main() 
Run Code Online (Sandbox Code Playgroud)

这是错误:

Pango:ERROR:/build/pango1.0-LVHqeM/pango1.0-1.30.0/./pango/pango-            layout.c:3801:pango_layout_check_lines: assertion failed: (!layout->log_attrs) Aborted
Run Code Online (Sandbox Code Playgroud)

关于我做错了什么的任何建议?我(显然)是线程新手.

python multithreading wxpython

3
推荐指数
1
解决办法
1734
查看次数

标签 统计

multithreading ×1

python ×1

wxpython ×1