wxwidgets - how to stop growing width of window when child sizers width increased in wx.Dialog in wxpython -


i new wxpython , wxwidgets.i have code wx.dialog 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 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 problem when statictextctrl sizers or listctrl sizers of self.detailssizer increase width of whole window size , subsizers width increasing on right side of window.

i wish fix dialog box size , subsizers should adjust within window size.that if 1 subsizer width increased, adjacent subsizer should adjust space..

is there way that? please me rid of issue.

edit:

this not user resizing dialog window..it width of dialog box dynamically growing horizontally.

for ex. in dialog box have 2 box sizers named listing , details adjacent each other in window of default size(-1,-1).

in details box displaying 'name' dynamically related selected option listing sizer..so length of 'name' change every time..if length more , string single word width of details sizer increased horizontally listing sizer increased.so main sizer of window increased below.

i not want growing , again coming normal window.the window size should fix , in case of 'name' length increased in details sizer ,the listing sizer should shrink , adjust detail sizer.

normal dialog box:

enter image description here

dynamically width increased:

enter image description here

desired output be:

enter image description here

maybe need add sizer without proportion. @ code

# horizontal splitter self.horzdetailssizer.add(self.listingsizer, 3, wx.expand) # line need changed self.horzdetailssizer.addspacer(5) self.horzdetailssizer.add(self.detailssizer, 2, wx.expand) 

when put proportion 0, children not grow on x axis, in y axis (because wx.expand used). try change code bellow

self.horzdetailssizer.add(self.listingsizer, 0, wx.expand) 

this blog (http://www.blog.pythonlibrary.org/2013/11/06/wxpython-101-using-frame-styles) have explanation wx flags. make dialog without resize try put:

class testdialog(wx.dialog):     def __init__(self,parent)         dialogstyle = wx.default_dialog_style& ~ (wx.resize_border | wx.resize_box | wx.maximize_box)         wx.dialog.__init__(self, parent, -1, style=dialogstyle) 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -