I am trying to create a text control that has a default height but a custom width. This is my current code:
tc = wx.TextCtrl(self, -1) tc.Size.SetWidth(300)
The width of the text control remains unchanged. I also tried calling tc.Layout() after changing the width without any results. I do not want to enter a custom size in the constructor of the class, since I want it to use the default height. I also tried to be more verbose if tc.GetSize returns a deep copy of the Size object:
tc = wx.TextCtrl(self, -1, size=(300, 23)) tc_size = tc.Size tc_size.SetWidth(300) tc.Size = tc_size tc.Layout()
Also to no avail. Why is my code not working and how to make it work?
Setting the size in the constructor works, so sizer is not related to the problem.
Hubro source share