Hey guys, I am building my own text editor in wxPython for fun and learning purposes. I want to add some highlighting of text similar to Notepad++ or other editors for python syntax. Can you guys point me in the right direction as far as that goes? I want to code it myself but I'm not sure where to start. Thanks!
wxPython: Text Editor Question About Font Color
Page 1 of 13 Replies - 381 Views - Last Post: 14 January 2013 - 01:19 PM
Replies To: wxPython: Text Editor Question About Font Color
#2
Re: wxPython: Text Editor Question About Font Color
Posted 01 January 2013 - 01:09 PM
Here's some sample code that might provide a good starting point for your text editor
This post has been edited by atraub: 01 January 2013 - 01:10 PM
#3
Re: wxPython: Text Editor Question About Font Color
Posted 14 January 2013 - 12:52 PM
I have already finished that much of the project,what i need is something to help me with highlighting text inside wxPythons TextCtrl
#4
Re: wxPython: Text Editor Question About Font Color
Posted 14 January 2013 - 01:19 PM
I don't think you can use TextCtrl (unless you want the whole thing to be the same colour) looks like you need StyledTextCtrl, right? You can select certain regions in the text and style them a certain way. That link above gives plenty of information, and also contains the link to documentation and examples.
Edit: And the wxPython official documentation for StyledTextCtrl, I don't think it's linked on that wiki.
For example to select some text use:
and then colour and modify it any way you please! Oh and don't forget to:
As it's a submodule of wxPython.
Edit: And the wxPython official documentation for StyledTextCtrl, I don't think it's linked on that wiki.
For example to select some text use:
SetSelection(start, end)
and then colour and modify it any way you please! Oh and don't forget to:
from wxPython.stc import *
As it's a submodule of wxPython.
This post has been edited by Simown: 14 January 2013 - 05:09 PM
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote





|