For the notebook to fill the whole panel I just moved to the bottom some
lines of code that were in the middle
I'm not sure what you mean with the buttons, but if you want them to stretch
across the whole panel, then you only needed to specify wxEXPAND and a
number greater than 0 in the second parameter. This second number is the
proportion in which the control in enlarged when compared to the other
controls. For example, if you pass 2, 1, 1 it would mean that your
"Kimutatás elkészítése" button will always be twice as large as the other
buttons. The wxLEFT you have is to set a border to the left of the controls.
In your case, the border is 10. You could also use wxALL.
Notice that I got rid of the background colours as the flickering was pretty
bad (at least in my machine)
from wxPython.wx import *
class TestFrame(wxFrame):
def __init__(self, parent, log):
wxFrame.__init__(self, parent, -1, "My Test Frame",
style=wxDEFAULT_FRAME_STYLE)
mainSizer = wxBoxSizer(wxVERTICAL)
rootPanel = wxPanel(self, -1)
panel1 = wxPanel(rootPanel, -1, size=wxSize(300, 24))
panel2 = wxPanel(rootPanel, -1, size=wxSize(300, 200))
panel3 = wxPanel(rootPanel, -1, size=wxSize(300, 24))
#panel1.SetBackgroundColour(wxColour(20, 30, 40))
#panel2.SetBackgroundColour(wxColour(202, 200, 200))
#panel3.SetBackgroundColour(wxColour(0, 200, 40))
mainSizer.Add(panel1, 0, wxEXPAND|wxHORIZONTAL)
mainSizer.Add(panel2, 1, wxEXPAND|wxALL)
mainSizer.Add(panel3, 0, wxEXPAND|wxHORIZONTAL)
topSizer = wxBoxSizer(wxHORIZONTAL)
button1=wxButton(panel1,-1,"Kimutatás elkészítése")
button2=wxButton(panel1,-1,"Tipp")
button3=wxButton(panel1,-1,"Kilépés")
topSizer.Add(button1,1,wxEXPAND|wxHORIZONTAL|wxLEFT,10)
topSizer.Add(button2,1,wxEXPAND|wxHORIZONTAL|wxLEFT,10)
topSizer.Add(button3,1,wxEXPAND|wxHORIZONTAL|wxLEFT,10)
panel1.SetSizer(topSizer)
topSizer.SetSizeHints(panel1)
nb=wxNotebook(panel2,-1)
page1=wxWindow(nb, -1)
nb.AddPage(page1, "Diagram")
page2=wxWindow(nb, -1)
nb.AddPage(page2, "Kimutatás1")
page3=wxWindow(nb, -1)
nb.AddPage(page3, "Kimutatás2")
nbSizer=wxBoxSizer(wxHORIZONTAL)
nbSizer.Add(nb,1,wxEXPAND|wxALL,8)
panel2.SetSizer(nbSizer)
nbSizer.SetSizeHints(panel2)
rootPanel.SetAutoLayout(true)
rootPanel.SetSizer(mainSizer)
mainSizer.SetSizeHints(rootPanel)
mainSizer.Fit(self)
if __name__ == '__main__':
import sys
app = wxPySimpleApp()
frame = TestFrame(None, sys.stdout)
frame.Centre(wxBOTH)
frame.Show(true)
app.MainLoop()
···
----- Original Message -----
From: "Kepes Krisztian" <Kepes.Krisztian@peto.hu>
To: <wxPython-users@lists.wxwindows.org>
Sent: Wednesday, February 26, 2003 9:46 AM
Subject: [wxPython-users] Newbie -> another sizer problem -> sorry
Hi !
Your code is working, but I want to create more components on this frame.
But - I do wrong...
What I do wrong ?
I want to do these things:
- the NoteBook is filled his parent area
- the buttons are stretched in same width, like a grid cells, but with 8 px
border
This is the code (Sorry for no english sections):
Thanx for any help !
KK
from wxPython.wx import *
class TestFrame(wxFrame):
def __init__(self, parent, log):
wxFrame.__init__(self, parent, -1, "My Test Frame",
style=wxDEFAULT_FRAME_STYLE)
mainSizer = wxBoxSizer(wxVERTICAL)
rootPanel = wxPanel(self, -1)
panel1 = wxPanel(rootPanel, -1, size=wxSize(300, 24))
panel2 = wxPanel(rootPanel, -1, size=wxSize(300, 200))
panel3 = wxPanel(rootPanel, -1, size=wxSize(300, 24))
panel1.SetBackgroundColour(wxColour(20, 30, 40))
panel2.SetBackgroundColour(wxColour(202, 200, 200))
panel3.SetBackgroundColour(wxColour(0, 200, 40))
mainSizer.Add(panel1, 0, wxEXPAND|wxHORIZONTAL)
mainSizer.Add(panel2, 1, wxEXPAND|wxALL)
mainSizer.Add(panel3, 0, wxEXPAND|wxHORIZONTAL)
rootPanel.SetAutoLayout(true)
rootPanel.SetSizer(mainSizer)
mainSizer.SetSizeHints(rootPanel)
mainSizer.Fit(self)
topSizer = wxBoxSizer(wxHORIZONTAL)
button1=wxButton(panel1,-1,"Kimutatás elkészítése")
button2=wxButton(panel1,-1,"Tipp")
button3=wxButton(panel1,-1,"Kilépés")
topSizer.Add(button1,0,wxLEFT|wxHORIZONTAL,10)
topSizer.Add(button2,0,wxLEFT|wxHORIZONTAL,10)
topSizer.Add(button3,0,wxLEFT|wxHORIZONTAL,10)
panel1.SetSizer(topSizer)
topSizer.SetSizeHints(panel1)
nb=wxNotebook(panel2,-1)
page1=wxWindow(nb, -1)
nb.AddPage(page1, "Diagram")
page2=wxWindow(nb, -1)
nb.AddPage(page2, "Kimutatás1")
page3=wxWindow(nb, -1)
nb.AddPage(page3, "Kimutatás2")
nbSizer=wxBoxSizer(wxHORIZONTAL)
nbSizer.Add(nb,1,wxEXPAND|wxALL,8)
panel2.SetSizer(nbSizer)
nbSizer.SetSizeHints(panel2)
if __name__ == '__main__':
import sys
app = wxPySimpleApp()
frame = TestFrame(None, sys.stdout)
frame.Centre(wxBOTH)
frame.Show(true)
app.MainLoop()
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org