在Python2.7中工作正常
尝试使用wx.PyControl公司在Python3.5中,得到警告:test_direct_svg.py:20: wxPyDeprecationWarning: Using deprecated class.
Use Control instead. wx.PyControl.init(self, parent, id, pos,
size, style, validator, name)
如何在init中使用控件?
我正在执行的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()