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

Messagin system and APNS

iphone push-notification apple-push-notifications

I need to create an iphone app for messaging system .If one user send a message to other one , device need to frequently check with server if there is a message,It use more battery.

Randomly select from a dictionary for proxy use

python python-2.7 random dictionary proxy

With the following data how can I randomly select one of the dictionary items and pull both the xtest and the yblob?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.