How would you put a widget on the bottom side of a panel which uses a vertical boxsizer?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

How would you put a widget on the bottom side of a panel which uses a vertical boxsizer?

steve

Hi,

I have a panel, and I use a vertical box sizer to place widgets on it. I would like to place a gauge bar on the bottom side of the panel:

I try:


import wx
from wx.lib.agw import pygauge as

self.progress_gauge = PG.PyGauge(self, -1, size=(150,5),style=wx.GA_HORIZONTAL)

self.panel_sizer = wx.BoxSizer(wx.VERTICAL)
self.panel_sizer.Add(self.progress_gauge, 0,  wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_HORIZONTAL)



but the gauge isn't placed at the bottom of the panel. Instead, it is placed right below to the other widgets, what should I do?







--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How would you put a widget on the bottom side of a panel which uses a vertical boxsizer?

werner-3
Hi Steve,

On 7/12/2014 12:18, steve wrote:
>
> Hi,
>
> I have a panel, and I use a vertical box sizer to place widgets on it.
> I would like to place a gauge bar on the bottom side of the panel:
>
What about have:
panel1 with your text, button and calendar and have it expand and
proportions=1
panel2 with your gauge bar and have it just expand

If you don't know the WIT yet you might want to give it a try, I use it
all the time to fix up sizer related challenges I run into.

http://wiki.wxpython.org/Widget%20Inspection%20Tool

Werner


--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How would you put a widget on the bottom side of a panel which uses a vertical boxsizer?

werner-3
In reply to this post by steve
On 7/12/2014 12:18, steve wrote:

Hi,

...

I try:


import wx
from wx.lib.agw import pygauge as

self.progress_gauge = PG.PyGauge(self, -1, size=(150,5),style=wx.GA_HORIZONTAL)

self.panel_sizer = wx.BoxSizer(wx.VERTICAL)
self.panel_sizer.Add(self.progress_gauge, 0,  wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_HORIZONTAL)

Is your panel allowed to grow?  You could check that with the WIT.

Werner

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How would you put a widget on the bottom side of a panel which uses a vertical boxsizer?

werner-3
On 7/12/2014 12:56, Werner wrote:
On 7/12/2014 12:18, steve wrote:

Hi,

...

I try:


import wx
from wx.lib.agw import pygauge as

self.progress_gauge = PG.PyGauge(self, -1, size=(150,5),style=wx.GA_HORIZONTAL)

self.panel_sizer = wx.BoxSizer(wx.VERTICAL)
self.panel_sizer.Add(self.progress_gauge, 0,  wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_HORIZONTAL)

Is your panel allowed to grow?  You could check that with the WIT.
And I think you might need to use FlexGridSizer, it allows different size cells, instead of BoxSizer.

Werner

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How would you put a widget on the bottom side of a panel which uses a vertical boxsizer?

nepix32
In reply to this post by steve


On Saturday, July 12, 2014 12:18:20 PM UTC+2, steve wrote:

Hi,

I have a panel, and I use a vertical box sizer to place widgets on it. I would like to place a gauge bar on the bottom side of the panel:

I think the easiest way to accomplish what you want is to add a dummy element ("Spacer") with size (0,0) and proportoion 1 to your sizer (see code below). This works especially well if all other elements have a proportion of 0.

# add calendar to sizer here
self.panel_sizer.Add((0,0), 1, wx.EXPAND)
# add gauge to sizer here

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How would you put a widget on the bottom side of a panel which uses a vertical boxsizer?

Rufus V. Smith
In reply to this post by steve
did you remember to:

panel.SetSizer(self.panel_sizer)
panel.Layout()


??

But other than that, I would do it with the expandable spacer idea mentioned by nepix32


On Saturday, July 12, 2014 6:18:20 AM UTC-4, steve wrote:

Hi,

I have a panel, and I use a vertical box sizer to place widgets on it. I would like to place a gauge bar on the bottom side of the panel:

<a style="margin-left:1em;margin-right:1em" href="https://lh5.googleusercontent.com/-_Hj8GREbtBw/U8EKkpeVIQI/AAAAAAAAADE/IzYnsogLmEc/s1600/panel.JPG" target="_blank" onmousedown="this.href='https://lh5.googleusercontent.com/-_Hj8GREbtBw/U8EKkpeVIQI/AAAAAAAAADE/IzYnsogLmEc/s1600/panel.JPG';return true;" onclick="this.href='https://lh5.googleusercontent.com/-_Hj8GREbtBw/U8EKkpeVIQI/AAAAAAAAADE/IzYnsogLmEc/s1600/panel.JPG';return true;">

I try:


import wx
from wx.lib.agw import pygauge as

self.progress_gauge = PG.PyGauge(self, -1, size=(150,5),style=wx.GA_HORIZONTAL)

self.panel_sizer = wx.BoxSizer(wx.VERTICAL)
self.panel_sizer.Add(self.progress_gauge, 0,  wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_HORIZONTAL)



but the gauge isn't placed at the bottom of the panel. Instead, it is placed right below to the other widgets, what should I do?


<a style="margin-left:1em;margin-right:1em" href="https://lh6.googleusercontent.com/-X-xYqnOIlRw/U8ELD-7NEjI/AAAAAAAAADM/_yhlWN_HSOE/s1600/panel2.JPG" target="_blank" onmousedown="this.href='https://lh6.googleusercontent.com/-X-xYqnOIlRw/U8ELD-7NEjI/AAAAAAAAADM/_yhlWN_HSOE/s1600/panel2.JPG';return true;" onclick="this.href='https://lh6.googleusercontent.com/-X-xYqnOIlRw/U8ELD-7NEjI/AAAAAAAAADM/_yhlWN_HSOE/s1600/panel2.JPG';return true;">






--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How would you put a widget on the bottom side of a panel which uses a vertical boxsizer?

Nathan McCorkle
In reply to this post by steve
I've had good luck drawing GUI designs on paper by hand, then folding the paper or drawing lines at equal spacings. If I did that to your desired picture that you posted... I think I would have a vertical sizer with the top widgets, then place that in another vertical sizer, add two spacers to that (mySizer.AddStretchSpacer(1)), then add the progress Gauge with wx.ALIGN_BOTTOM.

On Saturday, July 12, 2014 3:18:20 AM UTC-7, steve wrote:

Hi,

I have a panel, and I use a vertical box sizer to place widgets on it. I would like to place a gauge bar on the bottom side of the panel:

<a style="margin-left:1em;margin-right:1em" href="https://lh5.googleusercontent.com/-_Hj8GREbtBw/U8EKkpeVIQI/AAAAAAAAADE/IzYnsogLmEc/s1600/panel.JPG" target="_blank" onmousedown="this.href='https://lh5.googleusercontent.com/-_Hj8GREbtBw/U8EKkpeVIQI/AAAAAAAAADE/IzYnsogLmEc/s1600/panel.JPG';return true;" onclick="this.href='https://lh5.googleusercontent.com/-_Hj8GREbtBw/U8EKkpeVIQI/AAAAAAAAADE/IzYnsogLmEc/s1600/panel.JPG';return true;">

I try:


import wx
from wx.lib.agw import pygauge as

self.progress_gauge = PG.PyGauge(self, -1, size=(150,5),style=wx.GA_HORIZONTAL)

self.panel_sizer = wx.BoxSizer(wx.VERTICAL)
self.panel_sizer.Add(self.progress_gauge, 0,  wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_HORIZONTAL)



but the gauge isn't placed at the bottom of the panel. Instead, it is placed right below to the other widgets, what should I do?


<a style="margin-left:1em;margin-right:1em" href="https://lh6.googleusercontent.com/-X-xYqnOIlRw/U8ELD-7NEjI/AAAAAAAAADM/_yhlWN_HSOE/s1600/panel2.JPG" target="_blank" onmousedown="this.href='https://lh6.googleusercontent.com/-X-xYqnOIlRw/U8ELD-7NEjI/AAAAAAAAADM/_yhlWN_HSOE/s1600/panel2.JPG';return true;" onclick="this.href='https://lh6.googleusercontent.com/-X-xYqnOIlRw/U8ELD-7NEjI/AAAAAAAAADM/_yhlWN_HSOE/s1600/panel2.JPG';return true;">






--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How would you put a widget on the bottom side of a panel which uses a vertical boxsizer?

Rufus V. Smith
In reply to this post by steve
I've had some time to mull it over, and I think the problem is the wx.ALIGN_* flags do not align the widget within the overall spacer, but rather within the area the spacer allocates for the widget.    Therefore you'll only see the effect if the space allocated for that widget is larger than the widget itself.

If all your widgets are put in with proportion 0, they will just be put in "sequentially" whether horizontal or vertical, at their size.  And won't be resized or moved.

Try Add'ing all the widgets into the spacer with proportion 1, expand the frame and see what happens...


On Saturday, July 12, 2014 6:18:20 AM UTC-4, steve wrote:

Hi,

I have a panel, and I use a vertical box sizer to place widgets on it. I would like to place a gauge bar on the bottom side of the panel:

<a style="margin-left:1em;margin-right:1em" href="https://lh5.googleusercontent.com/-_Hj8GREbtBw/U8EKkpeVIQI/AAAAAAAAADE/IzYnsogLmEc/s1600/panel.JPG" target="_blank" onmousedown="this.href='https://lh5.googleusercontent.com/-_Hj8GREbtBw/U8EKkpeVIQI/AAAAAAAAADE/IzYnsogLmEc/s1600/panel.JPG';return true;" onclick="this.href='https://lh5.googleusercontent.com/-_Hj8GREbtBw/U8EKkpeVIQI/AAAAAAAAADE/IzYnsogLmEc/s1600/panel.JPG';return true;">

I try:


import wx
from wx.lib.agw import pygauge as

self.progress_gauge = PG.PyGauge(self, -1, size=(150,5),style=wx.GA_HORIZONTAL)

self.panel_sizer = wx.BoxSizer(wx.VERTICAL)
self.panel_sizer.Add(self.progress_gauge, 0,  wx.ALIGN_BOTTOM | wx.ALIGN_CENTER_HORIZONTAL)



but the gauge isn't placed at the bottom of the panel. Instead, it is placed right below to the other widgets, what should I do?


<a style="margin-left:1em;margin-right:1em" href="https://lh6.googleusercontent.com/-X-xYqnOIlRw/U8ELD-7NEjI/AAAAAAAAADM/_yhlWN_HSOE/s1600/panel2.JPG" target="_blank" onmousedown="this.href='https://lh6.googleusercontent.com/-X-xYqnOIlRw/U8ELD-7NEjI/AAAAAAAAADM/_yhlWN_HSOE/s1600/panel2.JPG';return true;" onclick="this.href='https://lh6.googleusercontent.com/-X-xYqnOIlRw/U8ELD-7NEjI/AAAAAAAAADM/_yhlWN_HSOE/s1600/panel2.JPG';return true;">






--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.