Ilan1
1
Hi,
My goal is to create a dialog that fits It’s control’s size
I started by creating a dialog that contains only TextCtrl
def InitUI_option1(self):
self.CreateTextCtrl()
self.Layout()
def CreateTextCtrl(self):
textCtrl = ExpandoTextCtrl(self, -1, "", style=wx.TE_MULTILINE|wx.TE_RICH2 | wx.NO_BORDER | wx.TE_DONTWRAP)
for idx in range(0,10):
textCtrl.AppendText("text1 text1 text1 text1 text1 text1 \n")
``
This created the window I expected means - The size of the window was set to the size of the control without scrolling
Then I tried to insert the control to a BoxSizer in the following code
def InitUI_option2(self):
BoxSizer_TextCtrl = wx.BoxSizer(wx.HORIZONTAL)
BoxSizer_TextCtrl.Add(self.CreateTextCtrl(),1, flag = wx.ALL, border = 10)
self.SetSizer(BoxSizer_TextCtrl)
self.Layout()
``
And this made the control present only one line with scroll (which I don’t want)
you can see the dialogs in the attached file
I know I am missing something simple but I coul’d not find why
Thanks,
Ilan
Ilan1
2
see screen shots in the attached files
···
On Friday, November 11, 2016 at 9:35:14 AM UTC+2, Ilan Hindy wrote:
Hi,
My goal is to create a dialog that fits It’s control’s size
I started by creating a dialog that contains only TextCtrl
def InitUI_option1(self):
self.CreateTextCtrl()
self.Layout()
def CreateTextCtrl(self):
textCtrl = ExpandoTextCtrl(self, -1, "", style=wx.TE_MULTILINE|wx.TE_RICH2 | wx.NO_BORDER | wx.TE_DONTWRAP)
for idx in range(0,10):
textCtrl.AppendText("text1 text1 text1 text1 text1 text1 \n")
``
This created the window I expected means - The size of the window was set to the size of the control without scrolling
Then I tried to insert the control to a BoxSizer in the following code
def InitUI_option2(self):
BoxSizer_TextCtrl = wx.BoxSizer(wx.HORIZONTAL)
BoxSizer_TextCtrl.Add(self.CreateTextCtrl(),1, flag = wx.ALL, border = 10)
self.SetSizer(BoxSizer_TextCtrl)
self.Layout()
``
And this made the control present only one line with scroll (which I don’t want)
you can see the dialogs in the attached file
I know I am missing something simple but I coul’d not find why
Thanks,
Ilan