wxNotebook in a wxWindow doesn't stretch

jack at tornado.sh.cvut.cz.bbs jack at tornado.sh.cvut.cz.bbs
Fri Jul 14 19:30:03 EDT 2000


hi.


I am lost. After few hours of trying to solve it, I give up...

I have following piece of code (modified, shortened...):

class MainWindow(wxFrame):

    def __init__(self, parent, id, title):
        wxFrame.__init__(self, parent, id, title, size = (800, 600),
                         style=wxDEFAULT_FRAME_STYLE|
			 wxNO_FULL_REPAINT_ON_RESIZE)

        self.CreateStatusBar(1, wxST_SIZEGRIP)

	# is ksSPLIT is set, we split main window horizontally into two
	# subwindows
	if ksSPLIT:
	    self.splitter = wxSplitterWindow(self, -1, style=wxNO_3D|wxSP_3D)
	    self.leftWin = self.splitter
	    self.desktopFrame = wxWindow(self.splitter, -1)
	    self.desktopFrame.SetBackgroundColour(wxNamedColour("Pink"))
	else:
	    self.splitter = None
	    self.leftWin = None
	    self.desktopFrame = self

	# the following code won't reside in constructor later!
	# I need the desktopWin placed IN desktopFrame so that it occupies the
	# whole area of it
	# desktopWin may look differently depending on the application,
	# when no desktopWin is set up, desktopFrame should be visible
	
	self.desktopWin = wxNotebook(self.desktopFrame, -1)
	txt = wxTextCtrl(self.desktopWin, -1,
			 style = wxTE_MULTILINE|wxTE_READONLY|wxHSCROLL)
	self.desktopWin.AddPage(txt, "Overview")

	sizer = wxBoxSizer(wxHORIZONTAL)
	sizer.Add(self.desktopWin, 1, wxEXPAND | wxALIGN_CENTER, 5)
	self.desktopFrame.SetAutoLayout(true);
	self.desktopFrame.SetSizer(sizer);
	#sizer.Fit(self.desktopFrame)

        self.Show(true)

	if ksSPLIT:
	    self.splitter.SplitVertically(self.leftWin, self.desktopFrame)
	    self.splitter.SetSashPosition(180, true)
	    self.splitter.SetMinimumPaneSize(20)


	# a jeste pocatecni formular a jeho pracovni podminky
	self.aktivniFormular = None
	self.desktopWin  = None


now, when I set ksSPLIT = 0, everything works just fine. the desktopWin
occupies the whole area of desktopFrame (== self). but as soon as I change
ksSPLIT = 1, desktopWin takes only a very small area of desktopFrame (about
10x10 pixels) and it won't scale with the desktopFrame.

thanks for your help.
Jan

--
  Jan Fedak                            talk:jack at tornado.sh.cvut.cz
  mailto:J.Fedak at sh.cvut.cz                    mailto:jack at mobil.cz
                Linux - the ultimate NT Service Pack.



More information about the Python-list mailing list