In my application i am using a textctrl that displays certain messages along with the time…
In the demo of wxpython also there is a textctrl that scrolls down according to the new messages…
In the same way my text ctrl also scrolls down when new messages are appended to it.
In my app i am using the AppendText() for showing the messages…
I need to know what will happen to all the previous messages…
Will it get automatically deleted or do we need to delete it after a ceratin number of lines…My application need to run for several hours and hence the messages that appear each and every second will be very lengthy.All
these messages are appended to the previous text. i doubt what will happen if so many mesages get appended to the text ctrl.
Can anyone help me?
This is my first application in wxPython and i congragulate Robin for his wonderful creation…
and i also thank all the members of the list for helping me. This mailing list helped a lot…
Nothing will happen to them. The messages will always be available. If
you are using Windows (or you plan for the application to be run on
Windows), you should pass the wx.TE_RICH2 style to the text control.
This is because the default text control on Windows is limited to 64k of
text, and if your logs get *really* long, 64k may not be enough.
- Josiah
···
"Shine Anne" <m2ids2005@gmail.com> wrote:
In my app i am using the AppendText() for showing the messages..
I need to know what will happen to all the previous messages..
well if the text messages are going to be there…then it is a problem. since my app will run for a very long time and since i am appending the newly got messages all will get accumulated and it consumes a lot of memory. then i need to delete the previously shown messages…does any one know how to remove the previous messages when a particular length is reached…hope iam able to convey my point
In my app i am using the AppendText() for showing the messages…
I need to know what will happen to all the previous messages…
Nothing will happen to them. The messages will always be available. If
you are using Windows (or you plan for the application to be run on
Windows), you should pass the wx.TE_RICH2 style to the text control.
This is because the default text control on Windows is limited to 64k of
text, and if your logs get really long, 64k may not be enough.
well if the text messages are going to be there..then it is a problem. since my app will run for a very long time and since i am appending the newly got messages all will get accumulated and it consumes a lot of memory. then i need to delete the previously shown messages..does any one know how to remove the previous messages when a particular length is reached...hope iam able to convey my point
Assuming you keep track of the number of lines as you append them (linecount), then you could do :
well if the text messages are going to be there..then it is a problem. since my app will run for a very long time and since i am appending the newly got messages all will get accumulated and it consumes a lot of memory. then i need to delete the previously shown messages..does any one know how to remove the previous messages when a particular length is reached...hope iam able to convey my point
In an old project made with VB I used a simple ListBox instead of a TextCtrl to show realtime log messages.
Append the new log lines to the list. When the count lines reach some limit, then on each append, also remove the first line.
if lc.GetCount() > LimitLines:
lc.Remove(0) # remove the first line
lc.AppendAndEnsureVisible(logline) # add the new line
You must test the optimal value for limit lines, if you use a big number the push/pop operation may be slow.
well if the text messages are going to be there..then it is a problem. since my app will run for a very long time and since i am appending the newly got messages all will get accumulated and it consumes a lot of memory. then i need to delete the previously shown messages..does any one know how to remove the previous messages when a particular length is reached...hope iam able to convey my point
In an old project made with VB I used a simple ListBox instead of a TextCtrl to show realtime log messages.
Append the new log lines to the list. When the count lines reach some limit, then on each append, also remove the first line.
if lc.GetCount() > LimitLines:
lc.Remove(0) # remove the first line
lc.AppendAndEnsureVisible(logline) # add the new line
You must test the optimal value for limit lines, if you use a big number the push/pop operation may be slow.
If you use a virtual listctrl then you can just keep your log lines in a Python list and then adding/removing lines is only a matter appending or deleting items from the list, and adjusting the count in the listctrl.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!