hello
I want to put the text in the stc in a text file orderly. how can I do
this?
the count of stc is flexible. duplicable, changable.
Wonjun, Choi
hello
I want to put the text in the stc in a text file orderly. how can I do
this?
the count of stc is flexible. duplicable, changable.
Wonjun, Choi
Wonjun, Choi wrote:
I want to put the text in the stc in a text file orderly. how can I do
this?
the count of stc is flexible. duplicable, changable.
Have you looked at the samples in the demo? You get the entire contents
as a string using stc.GetText(). If you want the current styles along
with the characters, you use GetStyledText(), but then each character is
followed by a byte that indicates how it is styled.
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
actually there are also buttons in Sizer so I got this error.
AttributeError: ‘Button’ object has no attribute ‘GetText’
AttributeError: ‘Button’ object has no attribute ‘GetStyledText’
I wish I can distinguish the object in Sizer if the object is button or stc.
Wonjun, Choi
Maintain a list (or other type of collection) of the stc widgets, in whatever order that you want, and then implement something like the following pseudo code:
open output file
for stc in stcCollection:
get text from stc
write that text to the output file
close file
On 12/19/11 9:53 PM, Wonjun, Choi wrote:
hello
I want to put the text in the stc in a text file orderly. how can I do
this?
the count of stc is flexible. duplicable, changable.
--
Robin Dunn
Software Craftsman
See isinstance()
On 12/20/11 10:31 AM, 최원준 wrote:
actually there are also buttons in Sizer so I got this error.
AttributeError: 'Button' object has no attribute 'GetText'
AttributeError: 'Button' object has no attribute 'GetStyledText'I wish I can distinguish the object in Sizer if the object is button or stc.
--
Robin Dunn
Software Craftsman
something like this? but there is still error
allitems = self.Children
file = open(‘output/test.txt’, ‘w’)
stcControl = st.StyledTextCtrl
for stcControl in self.Children:
file.write(stcControl.Text())
file.close()
AttributeError: ‘Button’ object has no attribute ‘Text’
it seems like it works thanks.
I don’t know if this is the best way to print it out orderly. but it works
Wonjun, Choi
btw, can I specify the order of the output? for example,
UI displays like this order
stc1 text : 2
text.txt file (this is output file)
최원준 wrote:
btw, can I specify the
order of the output? for example,UI displays like this order -------------- stc1 text : 2 stc2 text : 3 stc3 text : 5 --------------
If these are three separate text controls, then of course you can
specify the order, but it’s up to you to do that. You have to know
what the proper order is. Since you added them, you should be able
to manage that.
I could print it out orderly.
thank you
Wonjun, Choi