wx.StaticText

i am working on the framework for a small GUI app. right now i do not
care that the buttons don't really do anything, that's for latter. i
am trying to add text over the 2 columns of buttons. but right now it
is only showing about a letter and a half. i have tried different
pos=, and size=, and i get 1.5 letters or nothing.

link to the .py file :
ftp://user1:thanksforallthefish@thanksforallthefish.endofinternet.net/facbac-005.py

scan of 3 pages from wxpython in action anout static text :
ftp://user1:thanksforallthefish@thanksforallthefish.endofinternet.net/Scan1.tif

Hi,
  sorry I can't get the source code, but I think you can use
wx.BoxSizer to layout the text and two column of buttons.
  for example, two column buttons can be put in a flexgridsizer, then
put text and this flexgridsizer in a wx.BoxSizer.
  Good Luck

···

On Jan 23, 8:26 pm, ecu_jon <hayesjd...@yahoo.com> wrote:

i am working on the framework for a small GUI app. right now i do not
care that the buttons don't really do anything, that's for latter. i
am trying to add text over the 2 columns of buttons. but right now it
is only showing about a letter and a half. i have tried different
pos=, and size=, and i get 1.5 letters or nothing.

link to the .py file :
ftp://user1:thanksforallthef...@thanksforallthefish.endofinternet.net/facbac-005.py

scan of 3 pages from wxpython in action anout static text :
ftp://user1:thanksforallthef...@thanksforallthefish.endofinternet.net/Scan1.tif

Hello ecu_jon,

Here is your code with a GridSizer.

# -----------------------------------------------------------------

import wx

class MyForm(wx.Frame):
    """make a frame, inherits wx.Frame"""
    def __init__(self):
        # create a frame, no parent, default to wxID_ANY
        wx.Frame.__init__(self, None, wx.ID_ANY, title="My Form",
                          pos=(300, 150), size=(500, 200))

        self.SetBackgroundColour("purple")

        # ------------

        panel = wx.Panel(self, wx.ID_ANY)

        self.title = wx.StaticText(panel, wx.ID_ANY, "FacBac")

        self.button1 = wx.Button(panel, id=-1, label='Button1')
        self.button1.Bind(wx.EVT_BUTTON, self.button1Click)
        self.button1.SetToolTip(wx.ToolTip("text here"))

        self.button2 = wx.Button(panel, id=-1, label='Button2')
        self.button2.Bind(wx.EVT_BUTTON, self.button2Click)
        self.button2.SetToolTip(wx.ToolTip("text here"))

        self.button3 = wx.Button(panel, id=-1, label='Button3')
        self.button3.Bind(wx.EVT_BUTTON, self.button3Click)
        self.button3.SetToolTip(wx.ToolTip("text here"))

        self.button4 = wx.Button(panel, id=-1, label='Button4')
        self.button4.Bind(wx.EVT_BUTTON, self.button4Click)
        self.button4.SetToolTip(wx.ToolTip("text here"))

        self.button5 = wx.Button(panel, id=-1, label='Button5')
        self.button5.Bind(wx.EVT_BUTTON, self.button5Click)
        self.button5.SetToolTip(wx.ToolTip("text here"))

        self.button6 = wx.Button(panel, id=-1, label='Button6')
        self.button6.Bind(wx.EVT_BUTTON, self.button6Click)
        self.button6.SetToolTip(wx.ToolTip("text here"))

        # ------------

        gridSizer = wx.GridSizer(rows=4, cols=2, hgap=5, vgap=5)
        gridSizer.Add(self.title, 0, wx.ALL|wx.EXPAND, 10)
        # This is a spacer
        gridSizer.Add((20, -1), proportion=1)
        gridSizer.Add(self.button1, 0, wx.ALL|wx.EXPAND, 5)
        gridSizer.Add(self.button2, 0, wx.ALL|wx.EXPAND, 5)
        gridSizer.Add(self.button3, 0, wx.ALL|wx.EXPAND, 5)
        gridSizer.Add(self.button4, 0, wx.ALL|wx.EXPAND, 5)
        gridSizer.Add(self.button5, 0, wx.ALL|wx.EXPAND, 5)
        gridSizer.Add(self.button6, 0, wx.ALL|wx.EXPAND, 5)

        # ------------

        topSizer = wx.BoxSizer(wx.VERTICAL)
        topSizer.Add(gridSizer, 0, wx.ALL|wx.EXPAND, 5)

        # ------------

        # SetSizeHints(minW, minH, maxW, maxH)
        self.SetSizeHints(500,200,500,200)

        panel.SetSizer(topSizer)
        topSizer.Fit(self)

···

#
-----------------------------------------------------------------

    def button1Click(self, event):
        self.button1.SetLabel("Button1 Clicked")

    def button2Click(self, event):
        self.button2.SetLabel("Button2 Clicked")

    def button3Click(self, event):
        self.button3.SetLabel("Button3 Clicked")

    def button4Click(self, event):
        self.button4.SetLabel("Button4 Clicked")

    def button5Click(self, event):
        self.button5.SetLabel("Button5 Clicked")

    def button6Click(self, event):
        self.button6.SetLabel("Button6 Clicked")

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

first, awesome thanks!

here is version7
ftp://user1:thanksforallthefish@thanksforallthefish.endofinternet.net/facbac-007.py
any chance you can suggest a way to align the text in the first 2
grids?
i tried wx.Align_center, it then wanted a point or touple. played with
number combos and wx.DefaultSize, nothing quite right.

Add them to the sizer with wx.ALIGN_CENTER and without wx.EXPAND, and then remove the extra spaces from the static text widgets. Using the WIT helps to visualize the different aspects of the layout. http://wiki.wxpython.org/Widget_Inspection_Tool

facbac-007.py (3.37 KB)

···

On 1/24/11 10:28 AM, ecu_jon wrote:

first, awesome thanks!

here is version7
ftp://user1:thanksforallthefish@thanksforallthefish.endofinternet.net/facbac-007.py
any chance you can suggest a way to align the text in the first 2
grids?
i tried wx.Align_center, it then wanted a point or touple. played with
number combos and wx.DefaultSize, nothing quite right.

--
Robin Dunn
Software Craftsman