Python3.5中的WxPydePreactionWarning
在Python2.7中工作正常 尝试在Python 3.5中使用wx.PyControl并获得警告: test_direct_svg.py:20:wxpydeproductionwarning:使用不推荐的类。 使用控件。wx.PyControl.init(自身、父项、id、位置、, 尺寸、样式、验证程序、名称) 如何在init中使用控件 我正在执行的Python代码:Python3.5中的WxPydePreactionWarning,python,wxpython,Python,Wxpython,在Python2.7中工作正常 尝试在Python 3.5中使用wx.PyControl并获得警告: test_direct_svg.py:20:wxpydeproductionwarning:使用不推荐的类。 使用控件。wx.PyControl.init(自身、父项、id、位置、, 尺寸、样式、验证程序、名称) 如何在init中使用控件 我正在执行的Python代码: import wx class ComponentFrame(wx.Frame): def __init__(sel
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
顺便说一句:别忘了frame.Show()
错误意味着您必须在所有位置使用
wx.Control
而不是wx.PyControl
顺便说一句:别忘了frame.Show()
再次阅读错误消息-这意味着您必须使用
wx.Control
而不是wx.PyControl
再次阅读错误消息-这意味着您必须使用wx.Control
而不是wx.PyControl
它目前只是一个警告,因此“不得不”可能有点强。但它警告你,它最终会被删除,所以“应该”是合适的。它目前只是一个警告,所以“必须”可能有点强。但它警告您,它最终将被删除,所以“应该”是合适的。
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.Control):
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.Control.__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))
frame.Show()
app.MainLoop()