In receivetext
you create an instance of wx.TextCtrl
, but you do not add it to the panel
. You also do not keep a reference to the instance, so it will be destroyed immediately by the garbage collector.
class MyFrame1 (wx.Frame):
def __init__(self):
super(MyFrame1, self).__init__()
fluid_sizer = wx.BoxSizer(wx.HORIZONTAL)
self.m_textCtrl1 = wx.TextCtrl(self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0)
fluid_sizer.Add(self.m_textCtrl1, 0, wx.ALL, 5)
self.SetSizer(fluid_sizer)
self.Layout()
The example shows that a wx.BoxSizer
was created and an wx.TextCtrl
. The reference to the text control is stored as self.m_textCtrl
. The text control is than added to the sizer, making it visible.