wx.StaticLine() size & position

Is there a way to dynamically place a wx.StaticLine in a panel, or do the
size and position need to be established by trial-and-error?

Rich

sizers

···

On Monday, July 21, 2014 10:28:24 AM UTC-7, fuzzydoc wrote:

Is there a way to dynamically place a wx.StaticLine in a panel, or do the

size and position need to be established by trial-and-error?

Rich

Nathan,

   That's what I was thinking, but I found no examples in the wiki or other
wxPython-oriented Web sites. I'll play with it.

Thanks,

Rich

···

On Mon, 21 Jul 2014, Nathan McCorkle wrote:

sizers

Well, adding the StaticLine to a sizer did no harm, but I also cannot see
what, if anything, it did. There appears to be no difference in spacing.

Thanks again,

Rich

···

On Mon, 21 Jul 2014, Rich Shepard wrote:

That's what I was thinking, but I found no examples in the wiki or other
wxPython-oriented Web sites. I'll play with it.

Usually when i do this, I do something like

my_sizer.Add(wx.StaticLine(), 1, wx.EXPAND|wx.ALL, 5)

This will cause the line to stretch with the window and also puts a 5-pixel buffer around the widget. You can change the value at the end to give more or less white space around the widget.

  • Mike
···

On Monday, July 21, 2014 2:24:52 PM UTC-5, fuzzydoc wrote:

On Mon, 21 Jul 2014, Rich Shepard wrote:

That’s what I was thinking, but I found no examples in the wiki or other

wxPython-oriented Web sites. I’ll play with it.

Well, adding the StaticLine to a sizer did no harm, but I also cannot see

what, if anything, it did. There appears to be no difference in spacing.

Thanks again,

Rich

Mike,

   Interesting. When I use this syntax python complains that:

TypeError: Required argument 'parent' (pos 1) not found

Ah, well, :slight_smile:

Rich

···

On Mon, 21 Jul 2014, Mike Driscoll wrote:

Usually when i do this, I do something like

my_sizer.Add(wx.StaticLine(), 1, wx.EXPAND|wx.ALL, 5)

Rich Shepard wrote:

···

On Mon, 21 Jul 2014, Mike Driscoll wrote:

Usually when i do this, I do something like

my_sizer.Add(wx.StaticLine(), 1, wx.EXPAND|wx.ALL, 5)

Mike,

   Interesting. When I use this syntax python complains that:

TypeError: Required argument 'parent' (pos 1) not found

I think he was suggesting a template. You need to provide a parent, and
presumably coordinates as well.

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.

Tim,

   Oh. OK.

Thanks,

Rich

···

On Mon, 21 Jul 2014, Tim Roberts wrote:

I think he was suggesting a template. You need to provide a parent, and
presumably coordinates as well.

did you pass self to wx.StaticLine()? I think it should be
my_sizer.Add(wx.StaticLine(self), 1, wx.EXPAND|wx.ALL, 5)

where self is the Panel (so it could be myPanel, instead of self)

···

On Monday, July 21, 2014 1:04:28 PM UTC-7, fuzzydoc wrote:

On Mon, 21 Jul 2014, Mike Driscoll wrote:

Usually when i do this, I do something like

my_sizer.Add(wx.StaticLine(), 1, wx.EXPAND|wx.ALL, 5)

Mike,

Interesting. When I use this syntax python complains that:

TypeError: Required argument ‘parent’ (pos 1) not found

Ah, well, :slight_smile:

Rich

Er, no. Does make a difference.

Mea culpa,

Rich

···

On Mon, 21 Jul 2014, Nathan McCorkle wrote:

did you pass self to wx.StaticLine()?

Yes, I did mean this:

my_sizer.Add(wx.StaticLine(self), 1, wx.EXPAND|wx.ALL, 5)

where self is usually the reference to the panel or parent you want the widget on.

  • Mike