简体   繁体   English

TextCtrl的对齐方式

[英]Alignment of TextCtrl

I have newly set up Linux Mint in my computer and learning wxpython(just because I was bored of tkinter and needed some rest from the headaches i got from creating large applications on it). 我已经在计算机上新设置了Linux Mint,并学习了wxpython(这是因为我对tkinter感到无聊,并且需要在创建大型应用程序的过程中感到头疼)。 I learned about first command 'TextCtrl'. 我了解了第一个命令“ TextCtrl”。 Every thing works except I have a bit problem. 一切正常,但我有一点问题。 the code is simple. 代码很简单。

panel = wx.Panel(self)
wx.TextCtrl(panel, position=(10, 10), size=(250,150)

the code works fine except when I run it the cursor and the text appears to be in the middle(like vertically middle). 该代码工作正常,但当我运行它时,光标和文本似乎在中间(如垂直中间)。 Searched the damn internet, never found a simple solution. 搜索该死的互联网,再也找不到一个简单的解决方案。 any guesses how can i align in to top in a single line of code? 任何猜测我如何才能在一行代码的顶部对齐?

screenshot 截图

I think wx.Python will automatically align the text to the center in the vertical direction. 我认为wx.Python会自动将文本在垂直方向上对齐到中心。 If you need a wx.TextCtrl that big, I guess you want a multiline wx.TextCtrl . 如果您需要一个大的wx.TextCtrl ,我想您需要一个多行wx.TextCtrl This you can get with the style parameter: 您可以通过style参数获得:

wx.TextCtrl(panel, position=(10, 10), size=(250,150), style=wx.TE_MULTILINE)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM