Python wxTextCtrl move text 4 spaces on tab key down?

I have a wxTextCtrl and I have the cursor move 4 spaces on tab key down. But if I have not typed anything the cursor does not move nor does text when I press tab.

self.editor = wx.TextCtrl(splitter, style = wx.TE_MULTILINE)
wx.EVT_KEY_DOWN(self.editor, self.on_key_down)

def on_key_down(self, e):
    if e.GetKeyCode() == wx.WXK.TAB:
        current = self.editor.GetInsertionPoint()
        tab = current + 4

If anyone could help me with getting the cursor to move even if I've not typed anything in front of the cursor and any text in front of the cursor.

Also I would like to get certain key words to change colour when typed. If anyone could help with that I would be very appreciative.


Try using WriteText:

def on_key_down(self, e):
    if e.GetKeyCode() == wx.WXK_TAB:
        tab = ' ' * 4

Need Your Help

RequireJS production / dev variables

angularjs requirejs

I need to inject a angularjs module dependency when the app is in production mode. I'm using requirejs to handle script loading.

In html, how to get row data on button in which button is present?

jquery html html-table row

I am trying to get data from a table on button click for that row in which the clicked button is present.