This seems so simple but I can’t find any info on it. The default position on the plate buttons seems to Align Left. Is there an attribute to align the label to the Center?
Thanks,
Jake
This seems so simple but I can’t find any info on it. The default position on the plate buttons seems to Align Left. Is there an attribute to align the label to the Center?
Thanks,
Jake
Hi,
On Tue, Aug 27, 2013 at 8:54 AM, Jake Larrimore jacoblarrimore@gmail.com wrote:
This seems so simple but I can’t find any info on it. The default position on the plate buttons seems to Align Left. Is there an attribute to align the label to the Center?
No, there are no parameters to control text placement.
However the text should be centered by default. Only things that influence the text positioning are if the button has an image or an attached drop down menu associated with it.
What version of wxPython are you using and on what OS? There was a bug in an old version of the PlateButton that caused incorrect control sizing on Linux which could lead to extra space to the right of the button text.
Cody
Hi,
This seems so simple but I can’t find any info on it. The default position on the plate buttons seems to Align Left. Is there an attribute to align the label to the Center?
No, there are no parameters to control text placement.
However the text should be centered by default. Only things that influence the text positioning are if the button has an image or an attached drop down menu associated with it.
Hmm, I’m not seeing that. I’ve attached a small demo panel that shows the issue.
What version of wxPython are you using and on what OS? There was a bug in an old version of the PlateButton that caused incorrect control sizing on Linux which could lead to extra space to the right of the button text.
Sorry, should have included that in the original post:
wx.VERSION: 2.8.12.1
python 2.7.1
Windows 7
Thanks
platebuttontest.py (1.56 KB)
On Tuesday, August 27, 2013 10:17:07 AM UTC-4, Cody Precord wrote:
On Tue, Aug 27, 2013 at 8:54 AM, Jake Larrimore jacobla...@gmail.com wrote:
Cody
Hi,
On Tue, Aug 27, 2013 at 9:30 AM, Jake Larrimore jacoblarrimore@gmail.com wrote:
On Tuesday, August 27, 2013 10:17:07 AM UTC-4, Cody Precord wrote:
Hi,
On Tue, Aug 27, 2013 at 8:54 AM, Jake Larrimore jacobla...@gmail.com wrote:
This seems so simple but I can’t find any info on it. The default position on the plate buttons seems to Align Left. Is there an attribute to align the label to the Center?
No, there are no parameters to control text placement.
However the text should be centered by default. Only things that influence the text positioning are if the button has an image or an attached drop down menu associated with it.
Hmm, I’m not seeing that. I’ve attached a small demo panel that shows the issue.
What kind of layout are you trying to achieve?
The issue appears to be related to the use of the proportion > 0. If you set the proportion in the Add command to 0 for button4 the horizontal spacing of the text looks as it should.
The button does not appear to be handling the re-calc for the text position correctly when it is stretched beyond its intended “best” size. The placement was still being done based on the BestSize and not the current size of the control.
I have committed a fix to the version in Editra. I unfortunately don’t have have much time for wx projects any more so to get it back into the wx.lib version I will have to delegate to someone else to make a patch or merge over the change as I likely wont be able to get to it.
In the meantime you can either make the changes to your local copy or download the version from Editra and use that (also needs ecutil module).
http://svn.wxwidgets.org/viewvc/wx/wxPython/3rdParty/Editra/src/eclib/
http://svn.wxwidgets.org/viewvc/wx/wxPython/3rdParty/Editra/src/eclib/platebtn.py?r1=73153&r2=74715
Cody
Hi,
Hi,
This seems so simple but I can’t find any info on it. The default position on the plate buttons seems to Align Left. Is there an attribute to align the label to the Center?
No, there are no parameters to control text placement.
However the text should be centered by default. Only things that influence the text positioning are if the button has an image or an attached drop down menu associated with it.
Hmm, I’m not seeing that. I’ve attached a small demo panel that shows the issue.
What kind of layout are you trying to achieve?
This panel is being implemented throughout many windows as a menu along the bottom, so I’m doing it via a separate panel to make sure everything is consistent.
The issue appears to be related to the use of the proportion > 0. If you set the proportion in the Add command to 0 for button4 the horizontal spacing of the text looks as it should.
The button does not appear to be handling the re-calc for the text position correctly when it is stretched beyond its intended “best” size. The placement was still being done based on the BestSize and not the current size of the control.
Okay, I see that now. I hadn’t tried that. I guess it was being drawn first, then when placed in the sizer it wasn’t accounting for that resizing?? That seems like an odd implementation, and inconsistant with the rest of wx.
I have committed a fix to the version in Editra. I unfortunately don’t have have much time for wx projects any more so to get it back into the wx.lib version I will have to delegate to someone else to make a patch or merge over the change as I likely wont be able to get to it.
Kudos, I merge the code over in my lib and it works like a charm. Hopefully this makes it into the next release. If I knew anything about making patches I would help. Alas… I do not.
In the meantime you can either make the changes to your local copy or download the version from Editra and use that (also needs ecutil module).
Thanks again for the fast reply and updates, this worked well.
Much Appreciated,
Jake
On Tuesday, August 27, 2013 11:38:58 AM UTC-4, Cody Precord wrote:
On Tue, Aug 27, 2013 at 9:30 AM, Jake Larrimore jacobla...@gmail.com wrote:
On Tuesday, August 27, 2013 10:17:07 AM UTC-4, Cody Precord wrote:
On Tue, Aug 27, 2013 at 8:54 AM, Jake Larrimore jacobla...@gmail.com wrote:
Hi,
platebuttontest.py (1.66 KB)
On Tue, Aug 27, 2013 at 11:02 AM, Jake Larrimore jacoblarrimore@gmail.com wrote:
The issue appears to be related to the use of the proportion > 0. If you set the proportion in the Add command to 0 for button4 the horizontal spacing of the text looks as it should.
The button does not appear to be handling the re-calc for the text position correctly when it is stretched beyond its intended “best” size. The placement was still being done based on the BestSize and not the current size of the control.
Okay, I see that now. I hadn’t tried that. I guess it was being drawn first, then when placed in the sizer it wasn’t accounting for that resizing?? That seems like an odd implementation, and inconsistent with the rest of wx.
No, the control calculates its best size based on the size of its label, bitmap, menu and then uses that to determine where to draw the contents. The best size is always based on the contents of what needs to be displayed. However the actual size was being changed beyond the best size by the stretch factors applied by the sizer causing a discontinuity between the bounding rectangle of the control and how it was calculating where to draw its label.
Only asked about what kind of layout you wanted as was not sure of the intention of the seemingly random proportional values passed to the sizer Add method. See attachment for modified version of your sample that would have worked without the changes to the platebutton control. Though as mentioned not sure if the stretching in the original sample was intentional or not.
Cody
Hi,
The issue appears to be related to the use of the proportion > 0. If you set the proportion in the Add command to 0 for button4 the horizontal spacing of the text looks as it should.
The button does not appear to be handling the re-calc for the text position correctly when it is stretched beyond its intended “best” size. The placement was still being done based on the BestSize and not the current size of the control.
Okay, I see that now. I hadn’t tried that. I guess it was being drawn first, then when placed in the sizer it wasn’t accounting for that resizing?? That seems like an odd implementation, and inconsistent with the rest of wx.
No, the control calculates its best size based on the size of its label, bitmap, menu and then uses that to determine where to draw the contents. The best size is always based on the contents of what needs to be displayed. However the actual size was being changed beyond the best size by the stretch factors applied by the sizer causing a discontinuity between the bounding rectangle of the control and how it was calculating where to draw its label.
Oh okay. Still that seems inconsistent with other wx widgets.
Only asked about what kind of layout you wanted as was not sure of the intention of the seemingly random proportional values passed to the sizer Add method. See attachment for modified version of your sample that would have worked without the changes to the platebutton control. Though as mentioned not sure if the stretching in the original sample was intentional or not.
Thank you for the code. And yes, the odd stretching factors in the original is what the customer wanted, so that’s what the customer gets
(It was needed to match a legacy software product they were running)
Thanks again,
Jake
On Tuesday, August 27, 2013 12:35:59 PM UTC-4, Cody Precord wrote:
On Tue, Aug 27, 2013 at 11:02 AM, Jake Larrimore jacobla...@gmail.com wrote:
Cody