Okay, I think I am really close to getting this gui thing figured out. My
problem is that when I run this, all of the widgets are in the upper left
corner. Obviously, I am missing something. If someone could tell me what I
have wrong here, I would greatly appreciate it. Thanks.
--vicki
···
-------------------------------------------------------
#Create the outer sizer which is essentially the main window
outerboxsizer = wxBoxSizer(wxVERTICAL)
#Connect the outerboxsizer to the window (self)
self.SetSizer(outerboxsizer)
#Create a box inside to contain everything except the outputbox
innersizerbox =wxBoxSizer(wxHORIZONTAL)
#Create panel to contain other widgets (everything except the outputbox)
self.panel = wxPanel(self,-1,style=wxALIGN_BOTTOM|wxALIGN_CENTER)
#Create a flexsizer to contain other widgets (everything except the
#outputbox) need 2 rows and 9 columns
flexsizer= wxFlexGridSizer(9,2,0,0)
self.panel.SetSizer(flexsizer)
#Create a box to which to write output
self.outputbox = wxTextCtrl(self, -1, "",size=wxDefaultSize,
style=wxTE_READONLY|wxTE_WORDWRAP|wxTE_MULTILINE)
#Now add the output box to the outerboxsize
outerboxsizer.Add(self.outputbox, 1, wxEXPAND|wxALL, 10)
self.file_input = wxRadioButton(self, 31, label='Read input from file',
pos=(-1,-1))
self.gui_input = wxRadioButton(self, 36, label='Select command below',
pos=(1,-1))
EVT_RADIOBUTTON(self, 31, self.SetMode)
EVT_RADIOBUTTON(self, 36, self.SetMode)
radiosizer = wxBoxSizer(wxHORIZONTAL)
flexsizer.Add(self.file_input,0,1,wxALL, 10)
flexsizer.Add(self.gui_input, 1,1, wxEXPAND|wxALL, 15)
#Create combosizer which will contain the combobox and its label
combosizer = wxBoxSizer(wxHORIZONTAL)
#Create a Command Drop Down
self.combolabel = wxStaticText(self,-1,"Please select a command:")
self.combo=wxComboBox(self, 30, " ",
wxPoint(wxALIGN_LEFT),
wxDefaultSize,
self.List,wxCB_DROPDOWN)
EVT_COMBOBOX(self, 30, self.CommandCallback)
combosizer.Add(self.combolabel, 1, wxEXPAND|wxALL, 10)
combosizer.Add(self.combo, 2, wxEXPAND|wxALL, 10)
flexsizer.Add(combosizer, 1,2, wxEXPAND, 10)
#Create a file selection dialog for the output file.
self.filesel = wxFileDialog(self, message="Choose a file.",
defaultDir = "C:/",wildcard = "*.dat" )
#Create a box to accept parameters
self.parameterslabel = wxStaticText(self, -1, "Enter parameters:")
self.parameters=wxTextCtrl(self,-1,"", size=wxDefaultSize)
parametersizer = wxBoxSizer(wxHORIZONTAL)
parametersizer.Add(self.parameterslabel,0,wxALL, 10)
parametersizer.Add(self.parameters,1, wxALL, 15)
flexsizer.Add(parametersizer,1,3,wxALL,10)
#Create button 1
self.buttonone = wxButton(self, 32, label= "ONE",
style = wxBU_BOTTOM ,size=(150,20),
name = "one")
EVT_BUTTON(self, 32, self.One_Func)
#Create button 2
self.buttontwo = wxButton(self, 33, label= "TWO",
style = wxBU_BOTTOM ,size=(150,20),
name = "two")
EVT_BUTTON(self, 33, self.Two_Func)
#Create button 3
self.buttonthree = wxButton(self, 34, label= "THREE",
style = wxBU_BOTTOM ,size=(150,20),
name = "three")
EVT_BUTTON(self, 34, self.Three_Func)
#Create button 4
self.buttonfour = wxButton(self, 35, label= "FOUR",
style = wxBU_BOTTOM ,size=(150,20),
name = "four")
EVT_BUTTON(self, 35, self.Four_Func)
timeoutwarning=wxStaticText(self, -1, 'Disable Timeouts Prior to Use')
flexsizer.Add(self.buttonone, 1, 4, wxALL|wxALIGN_RIGHT, 10)
flexsizer.Add(self.buttontwo, 1, 5, wxALL|wxALIGN_RIGHT, 10)
flexsizer.Add(self.buttonthree, 1, 6, wxALL|wxALIGN_RIGHT, 10)
flexsizer.Add(self.buttonfour, 1, 8, wxALL|wxALIGN_RIGHT, 10)
flexsizer.Add(timeoutwarning, 1, 9, wxALL|wxALIGN_BOTTOM, 10)