Vertically center text in a wx.TextCtrl widget

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

Vertically center text in a wx.TextCtrl widget

Alex
I noticed that when I increase a TextCtrl widget's height, the text in the widget is not centered vertically, but rather aligned to the top edge of the widget, as shown in the screenshot below. I wonder if there is a way to make the text center vertically. 




--
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: Vertically center text in a wx.TextCtrl widget

Mike Driscoll


On Thursday, November 17, 2016 at 1:48:59 PM UTC-6, Alex wrote:
I noticed that when I increase a TextCtrl widget's height, the text in the widget is not centered vertically, but rather aligned to the top edge of the widget, as shown in the screenshot below. I wonder if there is a way to make the text center vertically. 



<a href="https://lh3.googleusercontent.com/-QLRjigtwFKc/WC4Ja-kmMGI/AAAAAAAAAgw/Lp0_J6bhiCURBpVuJqx_bEA1qCXkhABSACLcB/s1600/Capture.JPG" style="margin-left:1em;margin-right:1em" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://lh3.googleusercontent.com/-QLRjigtwFKc/WC4Ja-kmMGI/AAAAAAAAAgw/Lp0_J6bhiCURBpVuJqx_bEA1qCXkhABSACLcB/s1600/Capture.JPG&#39;;return true;" onclick="this.href=&#39;https://lh3.googleusercontent.com/-QLRjigtwFKc/WC4Ja-kmMGI/AAAAAAAAAgw/Lp0_J6bhiCURBpVuJqx_bEA1qCXkhABSACLcB/s1600/Capture.JPG&#39;;return true;">



I would try setting the control's wx.TE_CENTRE style flag

See the docs for more info: https://wxpython.org/Phoenix/docs/html/wx.TextCtrl.html

Mike

--
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.