必需的字符串或Unicode类型,wxPython StaticText [英] String or Unicode type required, wxPython StaticText
本文介绍了必需的字符串或Unicode类型,wxPython StaticText的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试制作wxPython静态文本小部件.由于某些原因,我不断收到下面的错误.
I'm trying to make a wxPython static text widget. For some reason I keep getting the error below.
摘要:
self.Label = wx.StaticText(self, pos=(sw/2.0 - w/2.0, sh/2.0 - h/2.0), label='hello')
错误:
", line 238, in make_label
self.Label = wx.StaticText(self, pos=(sw/2.0 - w/2.0, sh/2.0 - h/2.0), label='hello')
File "C:\Python26\lib\site-packages\wx-2.8-msw-ansi\wx\_core.py", line 8500, in SetLabel
return _core_.Window_SetLabel(*args, **kwargs)
TypeError: String or Unicode type required
推荐答案
标签是wx.Frame的属性,不允许尝试向其分配除字符串以外的任何内容.
供参考: http://www.wxpython.org/docs/api/wx.Window-class.html#SetLabel (wx.Frame是wx.Window的子类)
Label is a property of wx.Frame, and trying to assign anything other than a String to it is not allowed.
For reference: http://www.wxpython.org/docs/api/wx.Window-class.html#SetLabel (wx.Frame is a subclass of wx.Window)
这篇关于必需的字符串或Unicode类型,wxPython StaticText的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文