wxNotebook in a wxWindow doesn't stretch

olivierS.dagenaisP at canadaA.comM.bbs olivierS.dagenaisP at canadaA.comM.bbs
Sat Jul 15 00:10:13 EDT 2000


I've only recently started to learn wxPython, but I think I might have hit a
similar problem:

I had trouble getting constraints to make a number of controls sit side by
side, having widths that were proportional to the width of the entire frame.

Now, the only way to get it going was to embed the controls in ANOTHER
container, which is placed on the wxFrame that is your main application.
So, instead of creating a wxApp that contained a wxFrame that contained the
controls, I had to create a wxApp, that contained a wxFrame, that contained
a wxPanel (or maybe another wxFrame), which contained the controls.

Maybe it's a wxPython issue and you don't need to create as many levels in
pure wxWindows, or perhaps it's a wxWindows bug in itself (or bug in the MS
Windows implementation of wxWindows), but that's my experience with getting
a control (I guess I really sbould be calling them 'widgets') to resize
nicely with the main window.

I've seen the author of wxPython (Robin Dunn?) post in this newsgroup, so
maybe he'd be able to shed some light on this. (???)

--
----------------------------------------------------------------------
Olivier A. Dagenais - Carleton University - Computer Science III


"Jan Fedak" <jack at tornado.sh.cvut.cz> wrote in message
news:slrn8mv8ef.1sd.jack at tornado.sh.cvut.cz...
>
> 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