在Python 2.7 工程確定試圖在Python 3.5使用wx.PyControl並得到警告:wxPyDeprecationWarning在Python 3.5
test_direct_svg.py:20:wxPyDeprecationWarning:使用過時類。 改爲使用控制。 wx.PyControl。 初始化(自我,父母,ID,POS, 大小,樣式,驗證,名稱)
如何在初始化使用控制?
Python代碼我執行:
import wx
class ComponentFrame(wx.Frame):
def __init__(self, parent, id, title, pos, size):
wx.Frame.__init__(self, parent, id, title, pos, size)
self.panel = wx.Panel(self)
vbox = wx.BoxSizer(wx.HORIZONTAL)
component = SvgComponent(self.panel)
vbox.Add(component, 1, wx.EXPAND | wx.ALL, 10)
self.panel.SetSizer(vbox)
class SvgComponent(wx.PyControl):
def __init__(self, parent, label="",
id=wx.ID_ANY,
pos=wx.DefaultPosition,
size=wx.DefaultSize, style=wx.NO_BORDER, validator=wx.DefaultValidator,
name="LoggerUI"):
wx.PyControl.__init__(self, parent, id, pos, size, style, validator, name)
if __name__ == '__main__':
app = wx.App()
frame = ComponentFrame(None, wx.ID_ANY, 'test rsvg', (200, 200), (400, 400))
app.MainLoop()
讀取錯誤信息 - 這意味着你必須使用'wx.Control',而不是'wx.PyControl' – furas