The gridbagsizer is a good choice IMO. Try adding the lines in blue and see if this helps.
Ron
From: Mark Scala [mailto:markscala@gmail.com]
Sent: Thursday, August 11, 2005 2:54 PM
To: wxPython-users@lists.wxwidgets.org
Subject: [wxPython-users] grid question…Hey, folks.
I’ve been trying to get a notebook going, and I’ve cobbled together
the stuff below which works up to a point: I get the notebook, I get
all the controls (although they are not arranged yet). I want to use
a gridsizer here (perhaps a gridbagsizer?), but I can’t figure out
where to add the relevant lines of code. when I add them in Form1,
nothing works. how would I do this? perhaps someone could give an
example for one of the controls? thanks all.Here’s what I’ve got:
from wxPython.wx import *
import os
ID_ABOUT=101ID_BUTTON1=110
ID_EXIT=200class Form1(wxPanel):
def init(self, parent, id):
wxPanel.init(self, parent, id)#Text controls self.w1 = wxTextCtrl(self,-1,"", style = wxTE_READONLY) self.w2 = wxTextCtrl(self,-1,"", style = wxTE_READONLY) self.w3 = wxTextCtrl(self,-1,"", style = wxTE_READONLY) self.w4 = wxTextCtrl(self,-1,"", style = wxTE_READONLY) self.w5 = wxTextCtrl(self,-1,"", style = wxTE_READONLY) self.w6 = wxStaticText(self,-1,"Something here:",
style = wxALIGN_LEFT)
b1 = wxButton(self, -1, "[Button Text]", (10,5))
gbs = self.gbs = wx.GridBagSizer(5, 5) # 5x5 colum and row spacing
gbs.Add(w1, (1,1)
gbs.Add(w2, (2,1)
gbs.Add(w3, (3,1)
gbs.Add(w4, (4,1)
gbs.Add(w5, (5,1)
. . . . etc.
self.SetAutoLayout(True)
self.SetSizer(gbs)
self.Layout()
···
-----Original Message-----
self.Show(True)
class Form2(wxPanel):
def init(self, parent, id):
wxPanel.init(self, parent, id)
self.quote = wxStaticText(self, -1, “Stuff goes
here”,wxPoint(20, 30))class MainWindow(wxFrame):
def init(self,parent,id,title):
self.dirname=‘’
wxFrame.init(self,parent,wxID_ANY, title,
style=wxDEFAULT_FRAME_STYLE|
wxNO_FULL_REPAINT_ON_RESIZE)self.CreateStatusBar() # A Statusbar in the bottom of
the window
# Setting up the menu.
filemenu= wxMenu()filemenu.Append(ID_ABOUT, "&About"," Information
about this program")
filemenu.AppendSeparator()
filemenu.Append(ID_EXIT,“E&xit”," Terminate the program")
# Creating the menubar.
menuBar = wxMenuBar()
menuBar.Append(filemenu,“&File”) # Adding the
“filemenu” to the MenuBar
self.SetMenuBar(menuBar) # Adding the MenuBar to the
Frame content.
EVT_MENU(self, ID_ABOUT, self.OnAbout)
EVT_MENU(self, ID_EXIT, self.OnExit)self.Show(1) def OnAbout(self,e): d= wxMessageDialog( self, " Place description here ", "Another
bit here",wxOK)
# Create a message dialog box
d.ShowModal() # Shows it
d.Destroy() # finally destroy it when finished.def OnExit(self,e): self.Close(true) # Close the frame.
app = wxPySimpleApp()
frame = MainWindow(None, -1, “My First Notebook”)
nb = wxNotebook(frame,-1)
form1=Form1(nb, -1)
form2=Form2(nb,-1)
nb.AddPage(form1, “Page One”)
nb.AddPage(form2,“Page Two”)
frame.Show(1)
app.MainLoop()
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org