hello,what is wrong with this following code?who know?
import wx
class MyFrame(wx.Frame):
def init(self):
super().init(None, title=“文本输入控件”, size=(300, 260))
panel = wx.Panel(parent=self)
self.statictext=wx.StaticText(parent=panel,label=“请单击OK按钮”,pos=(110,20))
tc1 = wx.TextCtrl(panel)
b=wx.Button(parent=panel,label=‘OK’)
self.Bind(wx.EVT_BUTTON, self.on_click, b)
userid = wx.StaticText(panel, label="用户ID:")
# 创建垂直方向的盒子布局管理器对象vbox
vbox = wx.BoxSizer(wx.VERTICAL)
# 添加控件到vbox布局管理器
vbox.Add(userid, flag=wx.EXPAND|wx.LEFT, border=10)
vbox.Add(tc1, flag=wx.EXPAND|wx.ALL, border=10)
vbox.Add(b, flag=wx.EXPAND|wx.LEFT, border=10)
vbox.Add(self.statictext, flag=wx.EXPAND|wx.ALL, border=10)
# 设置面板(panel)采用vbox布局管理器
panel.SetSizer(vbox)
# 设置tc1初始值
tc1.SetValue('tony')
# 获取tc1值
print('读取用户ID:{0}'.format(tc1.GetValue()))
def on_click(self,event):
self.statictext.SetLabelText(tc1.SetValue())
app = wx.App()
frm = MyFrame()
frm.Show()
app.MainLoop()