该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
请教各位弟兄们一个问题,WxPython建立了三个文本框,如何将其中两个文本框中的内容在单击一个按钮后在第三个文本框中显示呢?
我写了个Case,但貌似是不正确的,请各位兄弟们指出错误:
class myApp(wx.App):
def OnInit(self):
frame = wx.Frame(None,
-1,
'title',
pos = (50, 50)
size = (100, 100)
style = wx.DEFAULT_FRAME_STYLE,
name = 'myApp')
panel = wx.Panel(frame, -1)
self.text1 = wx.TextCtrl(panel,
-1,
pos = (50, 50),
size = (50, 50),
style = wx.TE_RICH)
self.text2 = wx.TextCtrl(panel,
-1,
pos = (70, 50),
size = (50, 50),
style = wx.TE_RICH)
self.text3 = wx.TextCtrl(panel,
-1,
pos = (90, 50),
size = (50, 50),
style = wx.RE_RICH)
self.button1 = wx.Button(panel,
-1,
"myButton",
pos = (100, 100))
self.Bind(wx.EVT_BUTTON,
wx.OnButton1,
wx.button1)
frame.Show()
return True
def OnButton1(self, event):
self.text3 = self.text1 + self.text2
# or self.text3 = self.text1.GetValue() + self.text2.GetValue()
app = myApp()
app.MainLoop()
麻烦各位了,这个小程式最近还是比较急著“出货”的,呵呵