Search code examples
python-3.xwxpythonwxwidgets

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). I learned about first command '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


Solution

  • I think wx.Python will automatically align the text to the center in the vertical direction. If you need a wx.TextCtrl that big, I guess you want a multiline wx.TextCtrl. This you can get with the style parameter:

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