I’m new to Python and having trouble with fully understanding the BoxSizer all the other “sizer’s” and “layout’s” etc.
I have a TextCtrl that is connected to a Notebook tab, but the TextCtrl window does not fill the whole the tab space available.
I’ve got a split pannel with the right half filled with the notebook class. I’ve read where the attaching the textctrl directly into the notebook should fill automatically. However, in my case it does not.
What is it that I’m doing wrong?
Thank you!!
class MainWindow(wx.Frame):
def init(self, parent, title):
self.dirname=’’
A “-1” in the size parameter instructs wxWidgets to use the default size.
# In this case, we select 200px width and the default height.
wx.Frame.__init__(self, parent)
self.topSizer = wx.BoxSizer(wx.HORIZONTAL)
sp = wx.SplitterWindow(self)
p1 = wx.Panel(sp, style=wx.SUNKEN_BORDER)
p2 = wx.Panel(sp, style=wx.SUNKEN_BORDER)
sp.SplitVertically(p1, p2, 150)
p1Sizer = wx.BoxSizer(wx.VERTICAL)
self.treelist = TreeFrame(p1,1,wx.DefaultPosition,(-1,-1),wx.TR_HAS_BUTTONS)
p1Sizer.Add(self.treelist, 1, wx.ALL|wx.EXPAND, 0)
p1.SetSizer(p1Sizer)
notebook = Notebook(p2)
self.termOut = wx.TextCtrl(notebook.tabOne, -1, “Under Test”,style=wx.TE_MULTILINE|wx.TE_READONLY)
self.term1 = kbSerialDevice_1.SerialDevice(None,-1,text=self.termOut)
p2Sizer = wx.BoxSizer(wx.VERTICAL)
p2Sizer.Add(notebook, 1, wx.ALL|wx.EXPAND, 0)
p2.SetSizer(p2Sizer)
self.topSizer.Add(sp,1,wx.EXPAND)
self.SetSizer(self.topSizer)
self.SetAutoLayout(True)
self.SetSizeHints(400,500)
self.SetSize(wx.Size(600, 400))
class Notebook(wx.Notebook):
“”"
Notebook class
“”"
help.txt (2 KB)
···
#----------------------------------------------------------------------
def init(self, parent):
wx.Notebook.init(self, parent, id=wx.ID_ANY, style=
wx.BK_DEFAULT
)
Create the first tab
self.tabOne = TabPanel(self)
self.tabOne.SetBackgroundColour("Gray")
self.AddPage(self.tabOne, “Control”)
# Create and add the second tab
self.tabTwo = TabPanel(self)
self.AddPage(self.tabTwo, "Data Channel")
Create and add the third tab
self.tabThree = TabPanel(self)
self.AddPage(self.tabThree, "Printer Channel")