can I get current position line at real time?

I used stc.LineFromPosition(stc.GetCurrentPos()) method

but it was not work well.

when I move the cursor by using arrow key. some sepecific line is not
recognized.

I don't know why, could you please let me know the reason?

You'll need to explain more about what you are doing and what is going wrong. A small runnable sample would help too.

···

On 10/5/11 2:04 AM, Wonjun, Choi wrote:

I used stc.LineFromPosition(stc.GetCurrentPos()) method

but it was not work well.

when I move the cursor by using arrow key. some sepecific line is not
recognized.

I don't know why, could you please let me know the reason?

--
Robin Dunn
Software Craftsman

I just use the command " print stc.LineFromPosition(stc.GetCurrentPos()) " in the event of wx.stc.EVT_STC_STYLENEEDED

self.Bind(wx.stc.EVT_STC_STYLENEEDED, self.OnStyle)

def OnStyle(self, event):
self.custlex.StyleText(event)

def StyleText(self, event):
print stc.LineFromPosition(stc.GetCurrentPos())

but it did not display the cursor position in every time. I don’t know the reason.

···

2011/10/6 Robin Dunn robin@alldunn.com

On 10/5/11 2:04 AM, Wonjun, Choi wrote:

I used stc.LineFromPosition(stc.GetCurrentPos()) method

but it was not work well.

when I move the cursor by using arrow key. some sepecific line is not

recognized.

I don’t know why, could you please let me know the reason?

You’ll need to explain more about what you are doing and what is going wrong. A small runnable sample would help too.

Robin Dunn

Software Craftsman

http://wxPython.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

I think I found where this error came from.

it seems like GetCurrentPos() displays not current position when I use it with stc.StartStyling and stc.SetStyling method.

···

2011/10/6 최원준 wonjunchoi001@gmail.com

I just use the command " print stc.LineFromPosition(stc.GetCurrentPos()) " in the event of wx.stc.EVT_STC_STYLENEEDED

self.Bind(wx.stc.EVT_STC_STYLENEEDED, self.OnStyle)

def OnStyle(self, event):

   self.custlex.StyleText(event)

def StyleText(self, event):
print stc.LineFromPosition(stc.GetCurrentPos())

but it did not display the cursor position in every time. I don’t know the reason.

2011/10/6 Robin Dunn robin@alldunn.com

On 10/5/11 2:04 AM, Wonjun, Choi wrote:

I used stc.LineFromPosition(stc.GetCurrentPos()) method

but it was not work well.

when I move the cursor by using arrow key. some sepecific line is not

recognized.

I don’t know why, could you please let me know the reason?

You’ll need to explain more about what you are doing and what is going wrong. A small runnable sample would help too.

Robin Dunn

Software Craftsman

http://wxPython.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

There will not necessarily be a EVT_STC_STYLENEEDED event for every line. By definition it is sent whenever the STC thinks there is some range of the document that needs to have styling applied to it, such as when new portions of the text are made visible by scrolling and when lines are changed. Depending on what you want the EVT_STC_UPDATEUI may be a better event to use.

···

On 10/5/11 6:57 PM, 최원준 wrote:

I think I found where this error came from.

it seems like GetCurrentPos() displays not current position when I use
it with stc.StartStyling and stc.SetStyling method.

2011/10/6 최원준 <wonjunchoi001@gmail.com <mailto:wonjunchoi001@gmail.com>>

    I just use the command " print
    stc.LineFromPosition(stc.GetCurrentPos()) " in the event of
    wx.stc.EVT_STC_STYLENEEDED

    self.Bind(wx.stc.EVT_STC_STYLENEEDED, self.OnStyle)

    def OnStyle(self, event):
    self.custlex.StyleText(event)

    def StyleText(self, event):
    print stc.LineFromPosition(stc.GetCurrentPos())

    but it did not display the cursor position in every time. I don't
    know the reason.

--
Robin Dunn
Software Craftsman

I am little complicated about your answer.
I checked self.Bind(stc.EVT_STC_UPDATEUI, self.onUpdateUI) with self.StyleSetSpec(stc.STC_STYLE_DEFAULT, “face:%(helv)s,size:%(size)d” % faces)

I thought this is other way to highlight the specific word instead of using stc.StartStyling(start_pos, 0x1f). are those same? or different? if those are different,
which way is good for me? my purpose is explained below.

and after I heard from you that highlighting different language in one document is impossible, I have been thinking some alternative way to do this.

so when I move the cursor between “#begin_fortran” and “#end_fortran” using arrow key, I wanted the lexer to be changed as fortran lexer immediately.

until now I have been testing to check the possibility. but if this works well, the outside of the region between “#begin_fortran” and “#end_fortran” must be
not highlighted by fortran lexer. I am not sure whether this is possible or not.

I could change the lexer in stc by using SetPython() or SetFortran(). those have SetLexer function and StyleSetSpec method etc…
but in order to use different language in one document. I needed condition to change lexer immetiately between those languages.
so the condition was cursor point and I would like to ask you if this is possible.

2011년 10월 6일 오후 1:10, Robin Dunn robin@alldunn.com님의 말:

···

On 10/5/11 6:57 PM, 최원준 wrote:

I think I found where this error came from.

it seems like GetCurrentPos() displays not current position when I use

it with stc.StartStyling and stc.SetStyling method.

2011/10/6 최원준 <wonjunchoi001@gmail.com mailto:wonjunchoi001@gmail.com>

I just use the command " print

stc.LineFromPosition(stc.GetCurrentPos()) " in the event of

wx.stc.EVT_STC_STYLENEEDED



self.Bind(wx.stc.EVT_STC_STYLENEEDED, self.OnStyle)



def OnStyle(self, event):

self.custlex.StyleText(event)



def StyleText(self, event):

print stc.LineFromPosition(stc.GetCurrentPos())





but it did not display the cursor position in every time. I don't

know the reason.

There will not necessarily be a EVT_STC_STYLENEEDED event for every line. By definition it is sent whenever the STC thinks there is some range of the document that needs to have styling applied to it, such as when new portions of the text are made visible by scrolling and when lines are changed. Depending on what you want the EVT_STC_UPDATEUI may be a better event to use.

Robin Dunn

Software Craftsman

http://wxPython.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

I am sorry. I was confused between you and Cody Precord.
=> http://groups.google.com/group/wxpython-users/browse_thread/thread/7b20ab80bea3e972/6e9e9561423c5f26?hl=en&lnk=gst&q=on+the+same+screen#6e9e9561423c5f26

2011년 10월 6일 오후 2:10, 최원준 wonjunchoi001@gmail.com님의 말:

···

I am little complicated about your answer.
I checked self.Bind(stc.EVT_STC_UPDATEUI, self.onUpdateUI) with self.StyleSetSpec(stc.STC_STYLE_DEFAULT, “face:%(helv)s,size:%(size)d” % faces)

I thought this is other way to highlight the specific word instead of using stc.StartStyling(start_pos, 0x1f). are those same? or different? if those are different,

which way is good for me? my purpose is explained below.

and after I heard from you that highlighting different language in one document is impossible, I have been thinking some alternative way to do this.

so when I move the cursor between “#begin_fortran” and “#end_fortran” using arrow key, I wanted the lexer to be changed as fortran lexer immediately.

until now I have been testing to check the possibility. but if this works well, the outside of the region between “#begin_fortran” and “#end_fortran” must be

not highlighted by fortran lexer. I am not sure whether this is possible or not.

I could change the lexer in stc by using SetPython() or SetFortran(). those have SetLexer function and StyleSetSpec method etc…

but in order to use different language in one document. I needed condition to change lexer immetiately between those languages.
so the condition was cursor point and I would like to ask you if this is possible.

2011년 10월 6일 오후 1:10, Robin Dunn robin@alldunn.com님의 말:

On 10/5/11 6:57 PM, 최원준 wrote:

I think I found where this error came from.

it seems like GetCurrentPos() displays not current position when I use

it with stc.StartStyling and stc.SetStyling method.

2011/10/6 최원준 <wonjunchoi001@gmail.com mailto:wonjunchoi001@gmail.com>

I just use the command " print

stc.LineFromPosition(stc.GetCurrentPos()) " in the event of

wx.stc.EVT_STC_STYLENEEDED



self.Bind(wx.stc.EVT_STC_STYLENEEDED, self.OnStyle)



def OnStyle(self, event):

self.custlex.StyleText(event)



def StyleText(self, event):

print stc.LineFromPosition(stc.GetCurrentPos())





but it did not display the cursor position in every time. I don't

know the reason.

There will not necessarily be a EVT_STC_STYLENEEDED event for every line. By definition it is sent whenever the STC thinks there is some range of the document that needs to have styling applied to it, such as when new portions of the text are made visible by scrolling and when lines are changed. Depending on what you want the EVT_STC_UPDATEUI may be a better event to use.

Robin Dunn

Software Craftsman

http://wxPython.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

I am looking forward to your response.
I could highlight each language according to cursor point
but I want to highlight only inside of the block. how can I do?

2011년 10월 6일 오후 2:30, 최원준 wonjunchoi001@gmail.com님의 말:

···

I am sorry. I was confused between you and Cody Precord.
=> http://groups.google.com/group/wxpython-users/browse_thread/thread/7b20ab80bea3e972/6e9e9561423c5f26?hl=en&lnk=gst&q=on+the+same+screen#6e9e9561423c5f26

2011년 10월 6일 오후 2:10, 최원준 wonjunchoi001@gmail.com님의 말:

I am little complicated about your answer.
I checked self.Bind(stc.EVT_STC_UPDATEUI, self.onUpdateUI) with self.StyleSetSpec(stc.STC_STYLE_DEFAULT, “face:%(helv)s,size:%(size)d” % faces)

I thought this is other way to highlight the specific word instead of using stc.StartStyling(start_pos, 0x1f). are those same? or different? if those are different,

which way is good for me? my purpose is explained below.

and after I heard from you that highlighting different language in one document is impossible, I have been thinking some alternative way to do this.

so when I move the cursor between “#begin_fortran” and “#end_fortran” using arrow key, I wanted the lexer to be changed as fortran lexer immediately.

until now I have been testing to check the possibility. but if this works well, the outside of the region between “#begin_fortran” and “#end_fortran” must be

not highlighted by fortran lexer. I am not sure whether this is possible or not.

I could change the lexer in stc by using SetPython() or SetFortran(). those have SetLexer function and StyleSetSpec method etc…

but in order to use different language in one document. I needed condition to change lexer immetiately between those languages.
so the condition was cursor point and I would like to ask you if this is possible.

2011년 10월 6일 오후 1:10, Robin Dunn robin@alldunn.com님의 말:

On 10/5/11 6:57 PM, 최원준 wrote:

I think I found where this error came from.

it seems like GetCurrentPos() displays not current position when I use

it with stc.StartStyling and stc.SetStyling method.

2011/10/6 최원준 <wonjunchoi001@gmail.com mailto:wonjunchoi001@gmail.com>

I just use the command " print

stc.LineFromPosition(stc.GetCurrentPos()) " in the event of

wx.stc.EVT_STC_STYLENEEDED



self.Bind(wx.stc.EVT_STC_STYLENEEDED, self.OnStyle)



def OnStyle(self, event):

self.custlex.StyleText(event)



def StyleText(self, event):

print stc.LineFromPosition(stc.GetCurrentPos())





but it did not display the cursor position in every time. I don't

know the reason.

There will not necessarily be a EVT_STC_STYLENEEDED event for every line. By definition it is sent whenever the STC thinks there is some range of the document that needs to have styling applied to it, such as when new portions of the text are made visible by scrolling and when lines are changed. Depending on what you want the EVT_STC_UPDATEUI may be a better event to use.

Robin Dunn

Software Craftsman

http://wxPython.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

Robin, Please tell me your opinion.
Thank you.

2011년 10월 8일 오후 5:46, 최원준 wonjunchoi001@gmail.com님의 말:

···

I am looking forward to your response.
I could highlight each language according to cursor point
but I want to highlight only inside of the block. how can I do?

2011년 10월 6일 오후 2:30, 최원준 wonjunchoi001@gmail.com님의 말:

I am sorry. I was confused between you and Cody Precord.
=> http://groups.google.com/group/wxpython-users/browse_thread/thread/7b20ab80bea3e972/6e9e9561423c5f26?hl=en&lnk=gst&q=on+the+same+screen#6e9e9561423c5f26

2011년 10월 6일 오후 2:10, 최원준 wonjunchoi001@gmail.com님의 말:

I am little complicated about your answer.
I checked self.Bind(stc.EVT_STC_UPDATEUI, self.onUpdateUI) with self.StyleSetSpec(stc.STC_STYLE_DEFAULT, “face:%(helv)s,size:%(size)d” % faces)

I thought this is other way to highlight the specific word instead of using stc.StartStyling(start_pos, 0x1f). are those same? or different? if those are different,

which way is good for me? my purpose is explained below.

and after I heard from you that highlighting different language in one document is impossible, I have been thinking some alternative way to do this.

so when I move the cursor between “#begin_fortran” and “#end_fortran” using arrow key, I wanted the lexer to be changed as fortran lexer immediately.

until now I have been testing to check the possibility. but if this works well, the outside of the region between “#begin_fortran” and “#end_fortran” must be

not highlighted by fortran lexer. I am not sure whether this is possible or not.

I could change the lexer in stc by using SetPython() or SetFortran(). those have SetLexer function and StyleSetSpec method etc…

but in order to use different language in one document. I needed condition to change lexer immetiately between those languages.
so the condition was cursor point and I would like to ask you if this is possible.

2011년 10월 6일 오후 1:10, Robin Dunn robin@alldunn.com님의 말:

On 10/5/11 6:57 PM, 최원준 wrote:

I think I found where this error came from.

it seems like GetCurrentPos() displays not current position when I use

it with stc.StartStyling and stc.SetStyling method.

2011/10/6 최원준 <wonjunchoi001@gmail.com mailto:wonjunchoi001@gmail.com>

I just use the command " print

stc.LineFromPosition(stc.GetCurrentPos()) " in the event of

wx.stc.EVT_STC_STYLENEEDED



self.Bind(wx.stc.EVT_STC_STYLENEEDED, self.OnStyle)



def OnStyle(self, event):

self.custlex.StyleText(event)



def StyleText(self, event):

print stc.LineFromPosition(stc.GetCurrentPos())





but it did not display the cursor position in every time. I don't

know the reason.

There will not necessarily be a EVT_STC_STYLENEEDED event for every line. By definition it is sent whenever the STC thinks there is some range of the document that needs to have styling applied to it, such as when new portions of the text are made visible by scrolling and when lines are changed. Depending on what you want the EVT_STC_UPDATEUI may be a better event to use.

Robin Dunn

Software Craftsman

http://wxPython.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

btw, I wonder whether this is possible.

if stc.GetCurrentPos() > 1 and stc.GetCurrentPos() < 10:
stc.SetLexer(stc.STC_LEC_CPP)
elif stc.GetCurrentPos() > 10 and stc.GetCurrentPos() < 20:
stc.SetLexer(stc.STC_LEC_PYTHON)
elif stc.GetCurrentPos() > 20 and stc.GetCurrentPos() < 30:
stc.SetLexer(stc.STC_LEC_FORTRAN)
else:
stc.SetLexer(stc.STC_LEC_NULL)

AND when I set the style back, should I write like this?

stc.SetStyleBits(5)
stc.SetLexer(st.STC_LEX_NULL)
stc.ClearDocumentStyle()
stc.UpdateBaseStyles()

2011년 10월 8일 오후 5:47, 최원준 wonjunchoi001@gmail.com님의 말:

···

Robin, Please tell me your opinion.
Thank you.

2011년 10월 8일 오후 5:46, 최원준 wonjunchoi001@gmail.com님의 말:

I am looking forward to your response.
I could highlight each language according to cursor point
but I want to highlight only inside of the block. how can I do?

2011년 10월 6일 오후 2:30, 최원준 wonjunchoi001@gmail.com님의 말:

I am sorry. I was confused between you and Cody Precord.
=> http://groups.google.com/group/wxpython-users/browse_thread/thread/7b20ab80bea3e972/6e9e9561423c5f26?hl=en&lnk=gst&q=on+the+same+screen#6e9e9561423c5f26

2011년 10월 6일 오후 2:10, 최원준 wonjunchoi001@gmail.com님의 말:

I am little complicated about your answer.
I checked self.Bind(stc.EVT_STC_UPDATEUI, self.onUpdateUI) with self.StyleSetSpec(stc.STC_STYLE_DEFAULT, “face:%(helv)s,size:%(size)d” % faces)

I thought this is other way to highlight the specific word instead of using stc.StartStyling(start_pos, 0x1f). are those same? or different? if those are different,

which way is good for me? my purpose is explained below.

and after I heard from you that highlighting different language in one document is impossible, I have been thinking some alternative way to do this.

so when I move the cursor between “#begin_fortran” and “#end_fortran” using arrow key, I wanted the lexer to be changed as fortran lexer immediately.

until now I have been testing to check the possibility. but if this works well, the outside of the region between “#begin_fortran” and “#end_fortran” must be

not highlighted by fortran lexer. I am not sure whether this is possible or not.

I could change the lexer in stc by using SetPython() or SetFortran(). those have SetLexer function and StyleSetSpec method etc…

but in order to use different language in one document. I needed condition to change lexer immetiately between those languages.
so the condition was cursor point and I would like to ask you if this is possible.

2011년 10월 6일 오후 1:10, Robin Dunn robin@alldunn.com님의 말:

On 10/5/11 6:57 PM, 최원준 wrote:

I think I found where this error came from.

it seems like GetCurrentPos() displays not current position when I use

it with stc.StartStyling and stc.SetStyling method.

2011/10/6 최원준 <wonjunchoi001@gmail.com mailto:wonjunchoi001@gmail.com>

I just use the command " print

stc.LineFromPosition(stc.GetCurrentPos()) " in the event of

wx.stc.EVT_STC_STYLENEEDED



self.Bind(wx.stc.EVT_STC_STYLENEEDED, self.OnStyle)



def OnStyle(self, event):

self.custlex.StyleText(event)



def StyleText(self, event):

print stc.LineFromPosition(stc.GetCurrentPos())





but it did not display the cursor position in every time. I don't

know the reason.

There will not necessarily be a EVT_STC_STYLENEEDED event for every line. By definition it is sent whenever the STC thinks there is some range of the document that needs to have styling applied to it, such as when new portions of the text are made visible by scrolling and when lines are changed. Depending on what you want the EVT_STC_UPDATEUI may be a better event to use.

Robin Dunn

Software Craftsman

http://wxPython.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

I will give some summary
I was helped by janua

···

I have a stc.StyledTextControl, which I want to use to give highlighting to three different programming languages; Python, C and Fortran.

Inside the control, I separate the languages with comments, such as:

#__begin_fortran__
#__end_fortran__

When I click inside these blocks, I then set the appropriate lexer to give all the code the proper highlighting. The way it currently works is that when I change the lexer, it changes code highlighting for the whole control.

Is it possible to change the code highlighting/lexer for code only between the comment blocks?


2011년 10월 8일 오후 7:26, 최원준 wonjunchoi001@gmail.com님의 말:

btw, I wonder whether this is possible.

if stc.GetCurrentPos() > 1 and stc.GetCurrentPos() < 10:
stc.SetLexer(stc.STC_LEC_CPP)
elif stc.GetCurrentPos() > 10 and stc.GetCurrentPos() < 20:

stc.SetLexer(stc.STC_LEC_PYTHON)
elif stc.GetCurrentPos() > 20 and stc.GetCurrentPos() < 30:

stc.SetLexer(stc.STC_LEC_FORTRAN)
else:

stc.SetLexer(stc.STC_LEC_NULL)

AND when I set the style back, should I write like this?

stc.SetStyleBits(5)
stc.SetLexer(st.STC_LEX_NULL)
stc.ClearDocumentStyle()
stc.UpdateBaseStyles()

2011년 10월 8일 오후 5:47, 최원준 wonjunchoi001@gmail.com님의 말:

Robin, Please tell me your opinion.
Thank you.

2011년 10월 8일 오후 5:46, 최원준 wonjunchoi001@gmail.com님의 말:

I am looking forward to your response.
I could highlight each language according to cursor point
but I want to highlight only inside of the block. how can I do?

2011년 10월 6일 오후 2:30, 최원준 wonjunchoi001@gmail.com님의 말:

I am sorry. I was confused between you and Cody Precord.
=> http://groups.google.com/group/wxpython-users/browse_thread/thread/7b20ab80bea3e972/6e9e9561423c5f26?hl=en&lnk=gst&q=on+the+same+screen#6e9e9561423c5f26

2011년 10월 6일 오후 2:10, 최원준 wonjunchoi001@gmail.com님의 말:

I am little complicated about your answer.
I checked self.Bind(stc.EVT_STC_UPDATEUI, self.onUpdateUI) with self.StyleSetSpec(stc.STC_STYLE_DEFAULT, “face:%(helv)s,size:%(size)d” % faces)

I thought this is other way to highlight the specific word instead of using stc.StartStyling(start_pos, 0x1f). are those same? or different? if those are different,

which way is good for me? my purpose is explained below.

and after I heard from you that highlighting different language in one document is impossible, I have been thinking some alternative way to do this.

so when I move the cursor between “#begin_fortran” and “#end_fortran” using arrow key, I wanted the lexer to be changed as fortran lexer immediately.

until now I have been testing to check the possibility. but if this works well, the outside of the region between “#begin_fortran” and “#end_fortran” must be

not highlighted by fortran lexer. I am not sure whether this is possible or not.

I could change the lexer in stc by using SetPython() or SetFortran(). those have SetLexer function and StyleSetSpec method etc…

but in order to use different language in one document. I needed condition to change lexer immetiately between those languages.
so the condition was cursor point and I would like to ask you if this is possible.

2011년 10월 6일 오후 1:10, Robin Dunn robin@alldunn.com님의 말:

On 10/5/11 6:57 PM, 최원준 wrote:

I think I found where this error came from.

it seems like GetCurrentPos() displays not current position when I use

it with stc.StartStyling and stc.SetStyling method.

2011/10/6 최원준 <wonjunchoi001@gmail.com mailto:wonjunchoi001@gmail.com>

I just use the command " print

stc.LineFromPosition(stc.GetCurrentPos()) " in the event of

wx.stc.EVT_STC_STYLENEEDED



self.Bind(wx.stc.EVT_STC_STYLENEEDED, self.OnStyle)



def OnStyle(self, event):

self.custlex.StyleText(event)



def StyleText(self, event):

print stc.LineFromPosition(stc.GetCurrentPos())





but it did not display the cursor position in every time. I don't

know the reason.

There will not necessarily be a EVT_STC_STYLENEEDED event for every line. By definition it is sent whenever the STC thinks there is some range of the document that needs to have styling applied to it, such as when new portions of the text are made visible by scrolling and when lines are changed. Depending on what you want the EVT_STC_UPDATEUI may be a better event to use.

Robin Dunn

Software Craftsman

http://wxPython.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

My opinion is that I highly doubt that using different lexers in
different blocks will work, but that you should try it and find out for
yourself.

···

On 10/8/11 1:47 AM, 占쌍울옙占쏙옙 wrote:

Robin, Please tell me your opinion.

--
Robin Dunn
Software Craftsman

Thank you for your opinion.
I think I should modify the lexing method in c++ in order to do this. and it is unsafely.
so I will try another way.

···

2011/10/9 Robin Dunn robin@alldunn.com

On 10/8/11 1:47 AM, 최원준 wrote:

Robin, Please tell me your opinion.

My opinion is that I highly doubt that using different lexers in

different blocks will work, but that you should try it and find out for

yourself.

Robin Dunn

Software Craftsman

http://wxPython.org

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

Thank you for your opinion.

  I think I should modify the lexing method in c++ in order to do

this. and it is unsafely.

  so I will try another way.
        > Robin, Please tell me your opinion.
      My opinion is that I highly doubt that using different lexers

in

      different blocks will work, but that you should try it and

find out for

      yourself.
···

On 09/10/2011 9:50 AM, 최원준 wrote:

2011/10/9 Robin Dunn robin@alldunn.com

On 10/8/11 1:47 AM, 최원준 wrote:

I actually cannot understand what you saying.
this is my idea. is anyone same as your idea?

2011년 10월 9일 오후 7:17, Gadget/Steve GadgetSteve@live.co.uk님의 말:

···

On 09/10/2011 9:50 AM, 최원준 wrote:

Thank you for your opinion.

  I think I should modify the lexing method in c++ in order to do

this. and it is unsafely.

  so I will try another way.

2011/10/9 Robin Dunn robin@alldunn.com

On 10/8/11 1:47 AM, 최원준 wrote:

        > Robin, Please tell me your opinion.
      My opinion is that I highly doubt that using different lexers

in

      different blocks will work, but that you should try it and

find out for

      yourself.


          --

          Robin Dunn

          Software Craftsman

          [http://wxPython.org](http://wxPython.org)



          --

          To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

          or visit [http://groups.google.com/group/wxPython-users?hl=en](http://groups.google.com/group/wxPython-users?hl=en)
  --

  To unsubscribe, send email to

wxPython-users+unsubscribe@googlegroups.com

  or visit [http://groups.google.com/group/wxPython-users?hl=en](http://groups.google.com/group/wxPython-users?hl=en)
If you need to show/edit a single document that has multiple

programming languages in it to the user have you thought of
splitting it into sections according to language and then having a
STC for each section each with the appropriate lexer, with it’s
appropriate lanGuage. This might be a lot cleaner way of dealing
with your problem. If the user can edit the contents then the
sections could be (re-)merged on the document save and you could
possibly have a button for insert new section that prompts the user
for the language of the new section and creates a new STC for that
section.

Gadget/Steve

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

In Idea 1 - You are trying to have a single STC control with
multiple lexers running on different parts of it - I am suggesting
having several controls one per language section, i.e.

     Yours
···

wxPython-users+unsubscribe@googlegroups.com
http://groups.google.com/group/wxPython-users?hl=en

I would like to call miniFrame window included stc control to do this.
I found some example for miniFrame window in wx package.
and when I called miniFrame class in my code. I got an error like this.

_windows_.MiniFrame_swiginit(self,_windows_.new_MiniFrame(*args, **kwargs))

TypeError: in method ‘new_MiniFrame’, expected argument 1 of type ‘wxWindow *’

do you know any idea about this issue?

[example code]

···

import wx
class MyMiniFrame(wx.MiniFrame):
def __init__(
self, parent, title, pos=wx.DefaultPosition, size=wx.DefaultSize,
style=wx.DEFAULT_FRAME_STYLE ):
wx.MiniFrame.__init__(self, parent, -1, title, pos, size, style)
panel = wx.Panel(self, -1)
class BaseLexer(object):
"""Defines simple interface for custom lexer objects"""
def __init__(self):
super(BaseLexer, self).__init__()
class VowelLexer(BaseLexer):
def __init__(self):
super(VowelLexer, self).__init__()
win = MyMiniFrame(self, "This is a wx.MiniFrame", style=wx.DEFAULT_FRAME_STYLE | wx.TINY_CAPTION_HORIZ) <----------------------------------------------------------------- call function
win.SetSize((400, 400))
win.CenterOnParent(wx.BOTH)
win.Show(True) class CustomSTC(st.StyledTextCtrl):
def __init__(self, *args, **kwargs):
super(CustomSTC, self).__init__(*args, **kwargs)
class StyledTextApp(wx.App):
def OnInit(self):
self.frame = StcFrame(None, title="Custom Lexer")
self.frame.Show()
return True
class StcFrame(wx.Frame):
"""Main application window"""
def __init__(self, parent, *args, **kwargs):
super(StcFrame, self).__init__(parent,
*args,
**kwargs)
# Attributes
self.stc = CustomSTC(self)
if __name__ == '__main__':
app = StyledTextApp(False)
app.MainLoop()

2011년 10월 10일 오전 2:26, Gadget/Steve GadgetSteve@live.co.uk님의 말:

On 09/10/2011 1:06 PM, 최원준 wrote:

I actually cannot understand what you saying.

  this is my idea. is anyone same as your idea?
In  Idea 1 - You are trying to have a single STC control with

multiple lexers running on different parts of it - I am suggesting
having several controls one per language section, i.e.

     Yours

_____________________

> stc                          | 

> Some C                   |

>                               >

> Some Python            |

>                                >

> Some C                   |

>                                >

> etc.                         |

_____________________



    Mine:

----------------------

> STC                         |

> Some C                    |

>- - - - - - - - - - - - -|

> STC                          |

> Some Python            |

>- - - - - - - - - - - - -|

> Some C                   |

>                                >

>- - - - - - - - - - - - -|

> etc.                          |

>---------------------|



Hope that helps!



Gadget/Steve

2011년 10월 9일 오후 7:17, Gadget/Steve GadgetSteve@live.co.uk
의 말:

On 09/10/2011 9:50 AM, 최원준 wrote:

Thank you for your opinion.

              I think I should modify the lexing method in c++ in

order to do this. and it is unsafely.

              so I will try another way.

2011/10/9 Robin Dunn robin@alldunn.com

On 10/8/11 1:47 AM, 최원준 wrote:

                    > Robin, Please tell me your opinion.
                  My opinion is that I highly doubt that using

different lexers in

                  different blocks will work, but that you should

try it and find out for

                  yourself.


                      --

                      Robin Dunn

                      Software Craftsman

                      [http://wxPython.org](http://wxPython.org)



                      --

                      To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

                      or visit [http://groups.google.com/group/wxPython-users?hl=en](http://groups.google.com/group/wxPython-users?hl=en)
              --

              To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

              or visit [http://groups.google.com/group/wxPython-users?hl=en](http://groups.google.com/group/wxPython-users?hl=en)
        If you need to show/edit a single document that has multiple

programming languages in it to the user have you thought of
splitting it into sections according to language and then
having a STC for each section each with the appropriate
lexer, with it’s appropriate lanGuage. This might be a lot
cleaner way of dealing with your problem. If the user can
edit the contents then the sections could be (re-)merged on
the document save and you could possibly have a button for
insert new section that prompts the user for the language of
the new section and creates a new STC for that section.

          Gadget/Steve

          To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

          or visit [http://groups.google.com/group/wxPython-users?hl=en](http://groups.google.com/group/wxPython-users?hl=en)
  --

  To unsubscribe, send email to

wxPython-users+unsubscribe@googlegroups.com

  or visit [http://groups.google.com/group/wxPython-users?hl=en](http://groups.google.com/group/wxPython-users?hl=en)

<Snipped>
The problem with the offending line is that you are calling a function
(__inti__) with a parameter list of (self, parent, title, ...) with
parameters of (win_class, title), a common confusion because so many
times we use self.fn(x) to call a function with a type of fn(self, x) -
just change the line marked as a problem to read: win =
MyMiniFrame(self, self, ...............
You will also need to add the line:
import wx.stc as st

to your import list. The it runns.

Gadget/Steve

···

On 10/10/2011 7:43 AM, 占쌍울옙占쏙옙 wrote:

I would like to call miniFrame window included stc control to do this.
I found some example for miniFrame window in wx package.
and when I called miniFrame class in my code. I got an error like this.

_windows_.MiniFrame_swiginit(self,_windows_.new_MiniFrame(*args,
**kwargs))
TypeError: in method 'new_MiniFrame', expected argument 1 of type
'wxWindow *'

do you know any idea about this issue?

[example code]
---------------------------------------------------------------------------------------------
import wx
    
class MyMiniFrame(wx.MiniFrame):
    def __init__(
        self, parent, title, pos=wx.DefaultPosition, size=wx.DefaultSize,
        style=wx.DEFAULT_FRAME_STYLE
        ):

        wx.MiniFrame.__init__(self, parent, -1, title, pos, size, style)
        panel = wx.Panel(self, -1)

class BaseLexer(object):
    """Defines simple interface for custom lexer objects"""
    def __init__(self):
        super(BaseLexer, self).__init__()

class VowelLexer(BaseLexer):
    def __init__(self):
        super(VowelLexer, self).__init__()

        win = MyMiniFrame(self, "This is a wx.MiniFrame", style=wx.DEFAULT_FRAME_STYLE | wx.TINY_CAPTION_HORIZ) <----------------------------------------------------------------- call function
        win.SetSize((400, 400))
        win.CenterOnParent(wx.BOTH)
        win.Show(True)

class CustomSTC(st.StyledTextCtrl):
    def __init__(self, *args, **kwargs):
        super(CustomSTC, self).__init__(*args, **kwargs)

class StyledTextApp(wx.App):
    def OnInit(self):
        self.frame = StcFrame(None, title="Custom Lexer")
        self.frame.Show()
        return True

class StcFrame(wx.Frame):
    """Main application window"""
    def __init__(self, parent, *args, **kwargs):
        super(StcFrame, self).__init__(parent,
                                       *args,
                                       **kwargs)

        # Attributes
        self.stc = CustomSTC(self)

if __name__ == '__main__':
    app = StyledTextApp(False)
    app.MainLoop()

thank you I will try it.

···

2011/10/10 Gadget/Steve GadgetSteve@live.co.uk

On 10/10/2011 7:43 AM, 최원준 wrote:

I would like to call miniFrame window included stc control to do this.

I found some example for miniFrame window in wx package.

and when I called miniFrame class in my code. I got an error like this.

windows.MiniFrame_swiginit(self,windows.new_MiniFrame(*args,

**kwargs))

TypeError: in method ‘new_MiniFrame’, expected argument 1 of type

‘wxWindow *’

do you know any idea about this issue?

[example code]


import wx

class MyMiniFrame(wx.MiniFrame):

def __init__(
    self, parent, title, pos=wx.DefaultPosition, size=wx.DefaultSize,
    style=wx.DEFAULT_FRAME_STYLE
    ):
    wx.MiniFrame.__init__(self, parent, -1, title, pos, size, style)
    panel = wx.Panel(self, -1)

class BaseLexer(object):

"""Defines simple interface for custom lexer objects"""
def __init__(self):
    super(BaseLexer, self).__init__()

class VowelLexer(BaseLexer):

def __init__(self):
    super(VowelLexer, self).__init__()
    win = MyMiniFrame(self, "This is a wx.MiniFrame", style=wx.DEFAULT_FRAME_STYLE | wx.TINY_CAPTION_HORIZ)  <----------------------------------------------------------------- call function
    win.SetSize((400, 400))
    win.CenterOnParent(wx.BOTH)
    win.Show(True)

class CustomSTC(st.StyledTextCtrl):

def __init__(self, *args, **kwargs):
    super(CustomSTC, self).__init__(*args, **kwargs)

class StyledTextApp(wx.App):

def OnInit(self):
    self.frame = StcFrame(None, title="Custom Lexer")
    self.frame.Show()
    return True

class StcFrame(wx.Frame):

"""Main application window"""
def __init__(self, parent, *args, **kwargs):
    super(StcFrame, self).__init__(parent,
                                   *args,
                                   **kwargs)
    # Attributes
    self.stc = CustomSTC(self)

if name == ‘main’:

app = StyledTextApp(False)
app.MainLoop()

The problem with the offending line is that you are calling a function

(inti) with a parameter list of (self, parent, title, …) with

parameters of (win_class, title), a common confusion because so many

times we use self.fn(x) to call a function with a type of fn(self, x) -

just change the line marked as a problem to read: win =

MyMiniFrame(self, self, …

You will also need to add the line:

import wx.stc as st

to your import list. The it runns.

Gadget/Steve

To unsubscribe, send email to wxPython-users+unsubscribe@googlegroups.com

or visit http://groups.google.com/group/wxPython-users?hl=en

최원준 wrote:

I would like to call miniFrame window included stc control to do this.
I found some example for miniFrame window in wx package.
and when I called miniFrame class in my code. I got an error like this.

    _windows_.MiniFrame_swiginit(self,_windows_.new_MiniFrame(*args,
**kwargs))
TypeError: in method 'new_MiniFrame', expected argument 1 of type
'wxWindow *'

do you know any idea about this issue?

The error seems very clear. The MiniFrame requires that its parent be a
window. You are passing a VowelLexer object, which is not a window.

···

--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.