simple panel with many issues

I would appreciate any and all assistance possible - thanks in advance

I was able to find an example of a GridSizer and start hacking it.I was able to insert a combobox (will need 3 more) but the text alongside it should be "Name1" instead its "Name" which is for the textbox below (so I swapped them but thats not the correct way) can someone explain why? and how to fix?
I will be needing at least 3 testboxes (all of which will only take numeric entries so I will need to put validation in)
How to put this panel in a specific location?
I'm also going to put another button to do the selection again so I want to re-input. Can anybody advise on best structure?
the code is below
import wx
import easygui
import pyExcelerator
import xlrd
import MySQLdb

db = MySQLdb.connect(user="root", passwd="",
   db="automate-cisss")
cursor = db.cursor()

cursor.execute("""SELECT DISTINCT r.`Runtype` FROM runtype r;""")

runtypes = [item[0] for item in cursor.fetchall()]
#print runtypes

#easygui.msgbox(runtypes)

print runtypes
db = MySQLdb.connect(user="root", passwd="",
   db="automate-cisss")
cursor = db.cursor()
cursor.execute("""SELECT DISTINCT e.`Environment Name` FROM environments e;""")
envs = [item[0] for item in cursor.fetchall()]
print envs

#easygui.msgbox(envs)
db = MySQLdb.connect(user="root", passwd="",
   db="automate-cisss")
cursor = db.cursor()
cursor.execute("""SELECT DISTINCT a.`AUT` FROM `application under test` a;""")
AUT = [item[0] for item in cursor.fetchall()]
print AUT
wb = xlrd.open_workbook('C:\Data\CISSS\Resources\UserIDPassword.xls')
sh = wb.sheet_by_name(u'Sheet1')
authors = [sh.cell(rowx=0,colx=1).value, sh.cell(rowx=1,colx=1).value ]
#book = pyExcelerator.parse_xls("C:\Data\CISSS\Resources\UserIDPassword.xls")
#data = book[0][1]
#envs = [sh.cell(rowx=0,colx=1).value, sh.cell(rowx=1,colx=1).value ]
class MyForm(wx.Frame):
     def __init__(self):
        wx.Frame.__init__(self, None, wx.ID_ANY, title='My Form')
         # Add a panel so it looks correct on all platforms
        self.panel = wx.Panel(self, wx.ID_ANY)
         bmp = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_OTHER, (16, 16))
        titleIco = wx.StaticBitmap(self.panel, wx.ID_ANY, bmp)
        title = wx.StaticText(self.panel, wx.ID_ANY, 'My Title')

        lblSize = (50, -1)
        bmp = wx.ArtProvider.GetBitmap(wx.ART_TIP, wx.ART_OTHER, (16, 16))
        inputOneIco1 = wx.StaticBitmap(self.panel, wx.ID_ANY, bmp)
        labelOne1 = wx.StaticText(self.panel, wx.ID_ANY, 'Name1')
        #inputTxtOne1 = wx.TextCtrl(self.panel, wx.ID_ANY,'')
        cbAUT = wx.ComboBox(self.panel, -1, pos=(50, 70), size=(150, -1),
                choices=AUT, style=wx.CB_READONLY)
                    #choices=[cursor.fetchone(),cursor.fetchone()], style=wx.CB_READONLY)
                    #choices=["one","two","three"], style=wx.CB_READONLY)
        cbAUT.Bind(wx.EVT_COMBOBOX, self.OnSelect)
        bmp = wx.ArtProvider.GetBitmap(wx.ART_TIP, wx.ART_OTHER, (16, 16))
        inputOneIco = wx.StaticBitmap(self.panel, wx.ID_ANY, bmp)
        labelOne = wx.StaticText(self.panel, wx.ID_ANY, 'Name')
        inputTxtOne = wx.TextCtrl(self.panel, wx.ID_ANY,'')
         inputTwoIco = wx.StaticBitmap(self.panel, wx.ID_ANY, bmp)
        labelTwo = wx.StaticText(self.panel, wx.ID_ANY, 'Address')
        inputTxtTwo = wx.TextCtrl(self.panel, wx.ID_ANY,'')
         inputThreeIco = wx.StaticBitmap(self.panel, wx.ID_ANY, bmp)
        labelThree = wx.StaticText(self.panel, wx.ID_ANY, 'Email')
        inputTxtThree = wx.TextCtrl(self.panel, wx.ID_ANY, '')
         inputFourIco = wx.StaticBitmap(self.panel, wx.ID_ANY, bmp)
        labelFour = wx.StaticText(self.panel, wx.ID_ANY, 'Phone')
        inputTxtFour = wx.TextCtrl(self.panel, wx.ID_ANY, '')
         okBtn = wx.Button(self.panel, wx.ID_ANY, 'OK')
        cancelBtn = wx.Button(self.panel, wx.ID_ANY, 'Cancel')
        self.Bind(wx.EVT_BUTTON, self.onOK, okBtn)
        self.Bind(wx.EVT_BUTTON, self.onCancel, cancelBtn)
         topSizer = wx.BoxSizer(wx.VERTICAL)
        titleSizer = wx.BoxSizer(wx.HORIZONTAL)
        gridSizer = wx.GridSizer(rows=4, cols=2, hgap=5, vgap=5)
        inputOneSizer1 = wx.BoxSizer(wx.HORIZONTAL)
        inputOneSizer = wx.BoxSizer(wx.HORIZONTAL)
        inputTwoSizer = wx.BoxSizer(wx.HORIZONTAL)
        inputThreeSizer = wx.BoxSizer(wx.HORIZONTAL)
        inputFourSizer = wx.BoxSizer(wx.HORIZONTAL)
        btnSizer = wx.BoxSizer(wx.HORIZONTAL)
         titleSizer.Add(titleIco, 0, wx.ALL, 5)
        titleSizer.Add(title, 0, wx.ALL, 5)

        # each input sizer will contain 3 items
        # A spacer (proportion=1),
        # A bitmap (proportion=0),
        # and a label (proportion=0)
        inputOneSizer1.Add((20,20), proportion=1) # this is a spacer
        inputOneSizer1.Add(inputOneIco, 0, wx.ALL, 5)
        inputOneSizer1.Add(labelOne, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
        inputOneSizer.Add((20,20), proportion=1) # this is a spacer
        inputOneSizer.Add(inputOneIco, 0, wx.ALL, 5)
        inputOneSizer.Add(labelOne1, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
        inputTwoSizer.Add((20,20), 1, wx.EXPAND) # this is a spacer
        inputTwoSizer.Add(inputTwoIco, 0, wx.ALL, 5)
        inputTwoSizer.Add(labelTwo, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)

        inputThreeSizer.Add((20,20), 1, wx.EXPAND) # this is a spacer
        inputThreeSizer.Add(inputThreeIco, 0, wx.ALL, 5)
        inputThreeSizer.Add(labelThree, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
         inputFourSizer.Add((20,20), 1, wx.EXPAND) # this is a spacer
        inputFourSizer.Add(inputFourIco, 0, wx.ALL, 5)
        inputFourSizer.Add(labelFour, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)

        # Add the 3-item sizer to the gridsizer and
        # Right align the labels and icons
        gridSizer.Add(inputOneSizer, 0, wx.ALIGN_RIGHT)
        # Set the TextCtrl to expand on resize
        gridSizer.Add(cbAUT,0,wx.EXPAND)
        #gridSizer.Add(inputTxtOne1, 0, wx.EXPAND)
        gridSizer.Add(inputOneSizer1, 0, wx.ALIGN_RIGHT)
        gridSizer.Add(inputTxtOne, 0, wx.EXPAND)
        gridSizer.Add(inputTwoSizer, 0, wx.ALIGN_RIGHT)
        gridSizer.Add(inputTxtTwo, 0, wx.EXPAND)
        gridSizer.Add(inputThreeSizer, 0, wx.ALIGN_RIGHT)
        gridSizer.Add(inputTxtThree, 0, wx.EXPAND)
        gridSizer.Add(inputFourSizer, 0, wx.ALIGN_RIGHT)
        gridSizer.Add(inputTxtFour, 0, wx.EXPAND)
         btnSizer.Add(okBtn, 0, wx.ALL, 5)
        btnSizer.Add(cancelBtn, 0, wx.ALL, 5)
         topSizer.Add(titleSizer, 0, wx.CENTER)
        topSizer.Add(wx.StaticLine(self.panel), 0, wx.ALL|wx.EXPAND, 5)
        topSizer.Add(gridSizer, 0, wx.ALL|wx.EXPAND, 5) topSizer.Add(wx.StaticLine(self.panel), 0, wx.ALL|wx.EXPAND, 5)
        topSizer.Add(btnSizer, 0, wx.ALL|wx.CENTER, 5)

        # SetSizeHints(minW, minH, maxW, maxH)
        self.SetSizeHints(250,300,500,400)
                self.panel.SetSizer(topSizer)
        topSizer.Fit(self)

        # Do something
        print 'onOK handler'
     def onCancel(self, event):
        self.closeProgram()
     def closeProgram(self):
        self.Close()
     def OnSelect(self, event):
            win = event.GetEventObject() # call this if you want to know which box was clicked
            for ix, item in enumerate(self.cbs):
                if win == item:
                    break
            item = event.GetSelection()
            print "You selected item %s in combobox number %s" % (item,ix)

            mld = "You selected '"
            for cb in self.cbs:
                v1 = cb.GetValue()
                if v1:
                    mld = v1.join((mld,"', "))
            print mld[:-2]
            #easygui.msgbox(mld[:-2])

# Run the program
if __name__ == '__main__':
    app = wx.PySimpleApp()
    frame = MyForm().Show()
    app.MainLoop()

Joe and Janine Loyzaga wrote:

I would appreciate any and all assistance possible - thanks in advance

I was able to find an example of a GridSizer and start hacking it.I was able to insert a combobox (will need 3 more) but the text alongside it should be "Name1" instead its "Name" which is for the textbox below (so I swapped them but thats not the correct way) can someone explain why? and how to fix?

I don't understand the question here...you can change the text by putting a different string in:

labelOne1 = wx.StaticText(self.panel, wx.ID_ANY, 'Name1')
labelOne1 = wx.StaticText(self.panel, wx.ID_ANY, 'My Text String')
labelOne1 = wx.StaticText(self.panel, wx.ID_ANY, 'And now for something completely different!')

As I recall, items must be added to a GridSizer in a specific order. In this one you have a 4 X 2 grid where widgets are added left-to-right, top-to-bottom in a FIFO format. This example is complicated by nested sizers, which can help in aligning widgets among other things. Think of sizers as boxes and nested sizers as boxes within boxes. You can sketch out your layout on a piece of paper with boxes in boxes that contain widgets and directly translate it to sets of BoxSizers or higher level sizers.

By the way, this looks a lot like one of my examples from my blog. Hope it helped you more than it confused you.

I will be needing at least 3 testboxes (all of which will only take numeric entries so I will need to put validation in)

What's a "testbox"? Maybe you meant a textbox (i.e. wx.TextCtrl). You can use validators or masked controls for this. There are examples of both in the wxPython demo.

How to put this panel in a specific location?

What panel? Why do you need it?

I'm also going to put another button to do the selection again so I want to re-input. Can anybody advise on best structure?

Do you mean you want to reset the entry form? I'm confused. When you say structure, do you mean the structure of the code, the sizers or what? I would recommend the Style Guide: wxPython Style Guide - wxPyWiki

Also go back through the archives to May or April. There was a great discussion on ways to refactor a GUI using helper functions to do some of the heavy lifting. Here's a couple of links to various threads that may or may not help you:

http://lists.wxwidgets.org/pipermail/wxpython-users/2008-May/075820.html
http://lists.wxwidgets.org/pipermail/wxpython-users/2008-March/073589.html

Hmmm...I can't find the link I really wanted, but those might be enough. Hopefully others will have more productive suggestions than me.

···

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

But the text is adjacent to the wrong box

BTW I will look at all you suggest

it is from your blog -

masked validators - huh? I'll look at the tutorial

Mike Driscoll wrote:

···

Joe and Janine Loyzaga wrote:

I would appreciate any and all assistance possible - thanks in advance

I was able to find an example of a GridSizer and start hacking it.I was able to insert a combobox (will need 3 more) but the text alongside it should be "Name1" instead its "Name" which is for the textbox below (so I swapped them but thats not the correct way) can someone explain why? and how to fix?

I don't understand the question here...you can change the text by putting a different string in:

labelOne1 = wx.StaticText(self.panel, wx.ID_ANY, 'Name1')
labelOne1 = wx.StaticText(self.panel, wx.ID_ANY, 'My Text String')
labelOne1 = wx.StaticText(self.panel, wx.ID_ANY, 'And now for something completely different!')

As I recall, items must be added to a GridSizer in a specific order. In this one you have a 4 X 2 grid where widgets are added left-to-right, top-to-bottom in a FIFO format. This example is complicated by nested sizers, which can help in aligning widgets among other things. Think of sizers as boxes and nested sizers as boxes within boxes. You can sketch out your layout on a piece of paper with boxes in boxes that contain widgets and directly translate it to sets of BoxSizers or higher level sizers.

By the way, this looks a lot like one of my examples from my blog. Hope it helped you more than it confused you.

I will be needing at least 3 testboxes (all of which will only take numeric entries so I will need to put validation in)

What's a "testbox"? Maybe you meant a textbox (i.e. wx.TextCtrl). You can use validators or masked controls for this. There are examples of both in the wxPython demo.

How to put this panel in a specific location?

What panel? Why do you need it?

I'm also going to put another button to do the selection again so I want to re-input. Can anybody advise on best structure?

Do you mean you want to reset the entry form? I'm confused. When you say structure, do you mean the structure of the code, the sizers or what? I would recommend the Style Guide: wxPython Style Guide - wxPyWiki

Also go back through the archives to May or April. There was a great discussion on ways to refactor a GUI using helper functions to do some of the heavy lifting. Here's a couple of links to various threads that may or may not help you:

http://lists.wxwidgets.org/pipermail/wxpython-users/2008-May/075820.html
http://lists.wxwidgets.org/pipermail/wxpython-users/2008-March/073589.html

Hmmm...I can't find the link I really wanted, but those might be enough. Hopefully others will have more productive suggestions than me.

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

why is it on top left of form???

Mike Driscoll wrote:

gridsizer.py (7.12 KB)

···

Joe and Janine Loyzaga wrote:

I would appreciate any and all assistance possible - thanks in advance

I was able to find an example of a GridSizer and start hacking it.I was able to insert a combobox (will need 3 more) but the text alongside it should be "Name1" instead its "Name" which is for the textbox below (so I swapped them but thats not the correct way) can someone explain why? and how to fix?

I don't understand the question here...you can change the text by putting a different string in:

labelOne1 = wx.StaticText(self.panel, wx.ID_ANY, 'Name1')
labelOne1 = wx.StaticText(self.panel, wx.ID_ANY, 'My Text String')
labelOne1 = wx.StaticText(self.panel, wx.ID_ANY, 'And now for something completely different!')

As I recall, items must be added to a GridSizer in a specific order. In this one you have a 4 X 2 grid where widgets are added left-to-right, top-to-bottom in a FIFO format. This example is complicated by nested sizers, which can help in aligning widgets among other things. Think of sizers as boxes and nested sizers as boxes within boxes. You can sketch out your layout on a piece of paper with boxes in boxes that contain widgets and directly translate it to sets of BoxSizers or higher level sizers.

By the way, this looks a lot like one of my examples from my blog. Hope it helped you more than it confused you.

I will be needing at least 3 testboxes (all of which will only take numeric entries so I will need to put validation in)

What's a "testbox"? Maybe you meant a textbox (i.e. wx.TextCtrl). You can use validators or masked controls for this. There are examples of both in the wxPython demo.

How to put this panel in a specific location?

What panel? Why do you need it?

I'm also going to put another button to do the selection again so I want to re-input. Can anybody advise on best structure?

Do you mean you want to reset the entry form? I'm confused. When you say structure, do you mean the structure of the code, the sizers or what? I would recommend the Style Guide: wxPython Style Guide - wxPyWiki

Also go back through the archives to May or April. There was a great discussion on ways to refactor a GUI using helper functions to do some of the heavy lifting. Here's a couple of links to various threads that may or may not help you:

http://lists.wxwidgets.org/pipermail/wxpython-users/2008-May/075820.html
http://lists.wxwidgets.org/pipermail/wxpython-users/2008-March/073589.html

Hmmm...I can't find the link I really wanted, but those might be enough. Hopefully others will have more productive suggestions than me.

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Joe and Janine Loyzaga wrote:

But the text is adjacent to the wrong box

BTW I will look at all you suggest

it is from your blog -

masked validators - huh? I'll look at the tutorial

Not masked validators, but validators OR masked controls. See the following:

http://wiki.wxpython.org/DataFormatters
http://wiki.wxpython.org/Validator%20for%20Object%20Attributes
http://www.wxpython.org/docs/api/wx.Validator-class.html

http://www.wxpython.org/docs/api/wx.lib.masked.textctrl.BaseMaskedTextCtrl-class.html
http://www.wxpython.org/docs/api/wx.lib.masked.combobox.BaseMaskedComboBox-class.html

Which box do you want it next to?

Mike

···

Mike Driscoll wrote:

Joe and Janine Loyzaga wrote:

I would appreciate any and all assistance possible - thanks in advance

I was able to find an example of a GridSizer and start hacking it.I was able to insert a combobox (will need 3 more) but the text alongside it should be "Name1" instead its "Name" which is for the textbox below (so I swapped them but thats not the correct way) can someone explain why? and how to fix?

I don't understand the question here...you can change the text by putting a different string in:

labelOne1 = wx.StaticText(self.panel, wx.ID_ANY, 'Name1')
labelOne1 = wx.StaticText(self.panel, wx.ID_ANY, 'My Text String')
labelOne1 = wx.StaticText(self.panel, wx.ID_ANY, 'And now for something completely different!')

As I recall, items must be added to a GridSizer in a specific order. In this one you have a 4 X 2 grid where widgets are added left-to-right, top-to-bottom in a FIFO format. This example is complicated by nested sizers, which can help in aligning widgets among other things. Think of sizers as boxes and nested sizers as boxes within boxes. You can sketch out your layout on a piece of paper with boxes in boxes that contain widgets and directly translate it to sets of BoxSizers or higher level sizers.

By the way, this looks a lot like one of my examples from my blog. Hope it helped you more than it confused you.

I will be needing at least 3 testboxes (all of which will only take numeric entries so I will need to put validation in)

What's a "testbox"? Maybe you meant a textbox (i.e. wx.TextCtrl). You can use validators or masked controls for this. There are examples of both in the wxPython demo.

How to put this panel in a specific location?

What panel? Why do you need it?

I'm also going to put another button to do the selection again so I want to re-input. Can anybody advise on best structure?

Do you mean you want to reset the entry form? I'm confused. When you say structure, do you mean the structure of the code, the sizers or what? I would recommend the Style Guide: wxPython Style Guide - wxPyWiki

Also go back through the archives to May or April. There was a great discussion on ways to refactor a GUI using helper functions to do some of the heavy lifting. Here's a couple of links to various threads that may or may not help you:

http://lists.wxwidgets.org/pipermail/wxpython-users/2008-May/075820.html
http://lists.wxwidgets.org/pipermail/wxpython-users/2008-March/073589.html

Hmmm...I can't find the link I really wanted, but those might be enough. Hopefully others will have more productive suggestions than me.

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Joe and Janine Loyzaga wrote:

why is it on top left of form???

Because you didn't put it in a sizer or give it a specific position. The default position in that case if the upper left corner. If you do that with multiple widgets, they will stack on top of each other in an ugly manner.

Mike

···

Mike Driscoll wrote:

Joe and Janine Loyzaga wrote:

I would appreciate any and all assistance possible - thanks in advance

I was able to find an example of a GridSizer and start hacking it.I was able to insert a combobox (will need 3 more) but the text alongside it should be "Name1" instead its "Name" which is for the textbox below (so I swapped them but thats not the correct way) can someone explain why? and how to fix?

I don't understand the question here...you can change the text by putting a different string in:

labelOne1 = wx.StaticText(self.panel, wx.ID_ANY, 'Name1')
labelOne1 = wx.StaticText(self.panel, wx.ID_ANY, 'My Text String')
labelOne1 = wx.StaticText(self.panel, wx.ID_ANY, 'And now for something completely different!')

As I recall, items must be added to a GridSizer in a specific order. In this one you have a 4 X 2 grid where widgets are added left-to-right, top-to-bottom in a FIFO format. This example is complicated by nested sizers, which can help in aligning widgets among other things. Think of sizers as boxes and nested sizers as boxes within boxes. You can sketch out your layout on a piece of paper with boxes in boxes that contain widgets and directly translate it to sets of BoxSizers or higher level sizers.

By the way, this looks a lot like one of my examples from my blog. Hope it helped you more than it confused you.

I will be needing at least 3 testboxes (all of which will only take numeric entries so I will need to put validation in)

What's a "testbox"? Maybe you meant a textbox (i.e. wx.TextCtrl). You can use validators or masked controls for this. There are examples of both in the wxPython demo.

How to put this panel in a specific location?

What panel? Why do you need it?

I'm also going to put another button to do the selection again so I want to re-input. Can anybody advise on best structure?

Do you mean you want to reset the entry form? I'm confused. When you say structure, do you mean the structure of the code, the sizers or what? I would recommend the Style Guide: wxPython Style Guide - wxPyWiki

Also go back through the archives to May or April. There was a great discussion on ways to refactor a GUI using helper functions to do some of the heavy lifting. Here's a couple of links to various threads that may or may not help you:

http://lists.wxwidgets.org/pipermail/wxpython-users/2008-May/075820.html
http://lists.wxwidgets.org/pipermail/wxpython-users/2008-March/073589.html

Hmmm...I can't find the link I really wanted, but those might be enough. Hopefully others will have more productive suggestions than me.

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

------------------------------------------------------------------------

------------------------------------------------------------------------

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Joe and Janine Loyzaga wrote:

I would appreciate any and all assistance possible - thanks in advance

I think you'll find all this much easier to figure out if you test different pieces by themselves first -- make a small panel with a GridSizer and work on populating it, then add that code to the bigger project.

It'll also make it easier for us to help if you have problems:

http://wiki.wxpython.org/MakingSampleApps

also read:

http://wiki.wxpython.org/wxPython%20Style%20Guide

It may help.

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

the combobox is empty of a label

I also will need 3 checkboxes

Mike Driscoll wrote:

···

Joe and Janine Loyzaga wrote:

But the text is adjacent to the wrong box

BTW I will look at all you suggest

it is from your blog -

masked validators - huh? I'll look at the tutorial

Not masked validators, but validators OR masked controls. See the following:

DataFormatters - wxPyWiki
Validator for Object Attributes - wxPyWiki
wxPython API Documentation — wxPython Phoenix 4.2.2 documentation

wxPython API Documentation — wxPython Phoenix 4.2.2 documentation

wxPython API Documentation — wxPython Phoenix 4.2.2 documentation

Which box do you want it next to?

Mike

Mike Driscoll wrote:

Joe and Janine Loyzaga wrote:

I would appreciate any and all assistance possible - thanks in advance

I was able to find an example of a GridSizer and start hacking it.I was able to insert a combobox (will need 3 more) but the text alongside it should be "Name1" instead its "Name" which is for the textbox below (so I swapped them but thats not the correct way) can someone explain why? and how to fix?

I don't understand the question here...you can change the text by putting a different string in:

labelOne1 = wx.StaticText(self.panel, wx.ID_ANY, 'Name1')
labelOne1 = wx.StaticText(self.panel, wx.ID_ANY, 'My Text String')
labelOne1 = wx.StaticText(self.panel, wx.ID_ANY, 'And now for something completely different!')

As I recall, items must be added to a GridSizer in a specific order. In this one you have a 4 X 2 grid where widgets are added left-to-right, top-to-bottom in a FIFO format. This example is complicated by nested sizers, which can help in aligning widgets among other things. Think of sizers as boxes and nested sizers as boxes within boxes. You can sketch out your layout on a piece of paper with boxes in boxes that contain widgets and directly translate it to sets of BoxSizers or higher level sizers.

By the way, this looks a lot like one of my examples from my blog. Hope it helped you more than it confused you.

I will be needing at least 3 testboxes (all of which will only take numeric entries so I will need to put validation in)

What's a "testbox"? Maybe you meant a textbox (i.e. wx.TextCtrl). You can use validators or masked controls for this. There are examples of both in the wxPython demo.

How to put this panel in a specific location?

What panel? Why do you need it?

I'm also going to put another button to do the selection again so I want to re-input. Can anybody advise on best structure?

Do you mean you want to reset the entry form? I'm confused. When you say structure, do you mean the structure of the code, the sizers or what? I would recommend the Style Guide: wxPython Style Guide - wxPyWiki

Also go back through the archives to May or April. There was a great discussion on ways to refactor a GUI using helper functions to do some of the heavy lifting. Here's a couple of links to various threads that may or may not help you:

http://lists.wxwidgets.org/pipermail/wxpython-users/2008-May/075820.html

http://lists.wxwidgets.org/pipermail/wxpython-users/2008-March/073589.html

Hmmm...I can't find the link I really wanted, but those might be enough. Hopefully others will have more productive suggestions than me.

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org
Python Extension Building Network: http://www.pythonlibrary.org

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

I tried reducing all to just the comboboxes but I dont understand why the labels are to the right of the comboboxes - can anyone explain?
I'm trying to understand how it works by one step at a time

Joe

gridsizercombo-only.py (8.39 KB)

gridsizer-combo-only.gif

Joe and Janine Loyzaga wrote:

I tried reducing all to just the comboboxes but I dont understand why the labels are to the right of the comboboxes - can anyone explain?
I'm trying to understand how it works by one step at a time

Joe

It's because of the order in which you put the items in the sizers. While you put the icon and label in the BoxSizer correctly, you added the BoxSizer to the GridSizer AFTER you added a combobox. If you reverse the order so that you add your BoxSizer before the combobox, it will look correct.

Mike

···

------------------------------------------------------------------------

------------------------------------------------------------------------

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

inputThreeIco = wx.StaticBitmap(self.panel, wx.ID_ANY, bmp)
        labelThree = wx.StaticText(self.panel, wx.ID_ANY, 'Starting at what hour? - e.g. for tomorrow at 6 then just enter 6, 24 hour clock. For immediate start just accept (please note 99 should display). Press OK to accept .')
        inputTxtThree = wx.TextCtrl(self.panel, wx.ID_ANY, '')

    inputThreeSizer = wx.BoxSizer(wx.HORIZONTAL)
    inputThreeSizer.Add((20,20), 1, wx.EXPAND) # this is a spacer
        inputThreeSizer.Add(inputThreeIco, 0, wx.ALL, 5)
        inputThreeSizer.Add(labelThree, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)

how to make the text above that is the label for the text box wrap around to 2 lines or 3?
how to put value into textbox as default value?

Joe

Hello,

     inputThreeIco = wx.StaticBitmap(self.panel, wx.ID_ANY, bmp)
      labelThree = wx.StaticText(self.panel, wx.ID_ANY, 'Starting at what hour? - e.g. for tomorrow at 6 then just enter 6, 24 hour clock. For immediate start just accept (please note 99 should display). Press OK to accept .')
      inputTxtThree = wx.TextCtrl(self.panel, wx.ID_ANY, '')

  inputThreeSizer = wx.BoxSizer(wx.HORIZONTAL)
  inputThreeSizer.Add((20,20), 1, wx.EXPAND) # this is a spacer
      inputThreeSizer.Add(inputThreeIco, 0, wx.ALL, 5)
      inputThreeSizer.Add(labelThree, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)

how to make the text above that is the label for the text box wrap around to 2 lines or 3?
how to put value into textbox as default value?

See the documentation:
http://wxpython.org/docs/api/
http://wxpython.org/onlinedocs.php

wx.StaticText.Wrap(width)

wx.TextCtrl(parent, id, value='some default value')
wx.TextCtrl.SetValue('some value')

Cody

···

On Dec 27, 2008, at 6:48 PM, Joe and Janine Loyzaga wrote: