I am very new to wxpython and wxwidgets.I have the code for wx.Dialog like below.
def __init__(self, parent, Name, Platform):
wx.Dialog.__init__(self, parent, -1, 'Launch Dialog', size=(-1,-1), pos=(-1,-1))
###some code
self.createSizers()
self.Fit()
def createSizers()
self.mainSizer = wx.BoxSizer(wx.VERTICAL)
SelectionSizer = wx.StaticBoxSizer(self.staticBoxTestSelection, wx.VERTICAL)
self.horzDetailsSizer = wx.BoxSizer(wx.HORIZONTAL)
self.DetailsSizer = wx.BoxSizer(wx.VERTICAL)
### add func here
self.ListingSizer = wx.BoxSizer(wx.VERTICAL)
### add func here
# Horizontal Splitter
self.horzDetailsSizer.Add(self.ListingSizer, 3, wx.EXPAND)
self.horzDetailsSizer.AddSpacer(5)
self.horzDetailsSizer.Add(self.DetailsSizer, 2, wx.EXPAND)
# Add subsizers to main
SelectionSizer.Add(self.horzDetailsSizer, 1, wx.EXPAND | wx.ALL, 5)
self.mainSizer.Add(SelectionSizer, 0, wx.EXPAND | wx.LEFT | wx.RIGHT, 5)
### Initialize mainSize
self.SetSizer(self.mainSizer)
Here the problem is when the statictextctrl sizers or listctrl sizers of self.DetailsSizer
increase width of whole window size and also subsizers width is increasing on right side of window.
I wish to fix the dialog box size and the subsizers should adjust within the window size.That is if one subsizer width is increased, adjacent subsizer should adjust with the space..
Is there any way to do that? Please help me to get rid of this issue.
EDIT:
This is not about user resizing the dialog window..it is about the width of dialog box dynamically growing horizontally.
For ex. in my dialog box I have 2 box sizers named as listing and details adjacent to each other in the window of default size(-1,-1).
In details box I am displaying 'name' dynamically which is related to selected option from listing sizer..So the length of 'name' will change every time..If the length is more and the string is a single word the width of details sizer is increased horizontally so that listing sizer increased.So main sizer of window increased like below.
I do not want this growing and again coming to normal window.The window size should always fix and in case of 'name' length increased in details sizer ,the listing sizer should shrink and adjust with the detail sizer.
Normal Dialog box:
Dynamically width increased:
Desired output to be:
See Question&Answers more detail:
os