Reputation: 387
How do I change the size of wxPython widget after its creation? I am trying to dynamically change the width of a ComboBoxCtrl widget based on the elements in the popup. For the sake of simplicity lets say we create a button and try to resize it:
btn = wx.Button(self, wx.ID_ANY, 'Start', size=(25,-1))
btn.SetSize(wx.Size(25,25))
self.Layout()
In the above case, the new 25x25 size does not take. I can only get SetSize to work for a panel. I am assuming there is another call I should be using. How can I change the size of widget after creation?
Upvotes: 0
Views: 1482
Reputation: 387
The SetMinSize command does the trick.
btn = wx.Button(self, wx.ID_ANY, 'Start', size=(25,-1))
btn.SetMinSize(wx.Size(25,25))
self.Layout()
Upvotes: 2