Hi everyone,
Missed u all verymuch since i was not able to post any query for a long time.
I am having a problem. I have a textctrl that gets appended by certain maessages randomly…
but when it becomes too long i want to delete a no:of messages from the
top. i now wrote a fn() that performs the above requirement.
Itz like…
self.textWindow = wx.TextCtrl(bottomwin, -1, “”, wx.DefaultPosition,(900 100),style = textctrlStyle)
def clearBottomWindow_usingTextCtrl(self,strMsg):
if self.window.textWindow.GetNumberOfLines() > self.maxlines:
self.window.textWindow.Remove( 0,
self.window.textWindow.XYToPosition(0,self.removeLines))
self.window.textWindow.AppendText(time.strftime("%b %d %H:%M:%S
",time.localtime()))
self.window.textWindow.AppendText(strMsg)
else:
self.window.textWindow.AppendText(time.strftime("%b %d %H:%M:%S
",time.localtime()))
self.window.textWindow.AppendText(strMsg)
this works fine in windows but won’t work in linux becoz i think
functions like Remove() and XYToPosition() won’t work in Linux (thats
what i think so, not sure). more over when i am using a textctrl and
error called gtktextlayout.c is coming so i changed the textctrl to a
list ctrl.(since i was not able to slove that).
But in listctrl i see only Clear() fn; that clears all the items, not
certain items frm the top. Also the vertical scroll bar is not coming
is Linux eventhough i have specified teh style as ’ style = wx.LB_SINGLE|wx.LB_ALWAYS_SB ’
While using the Listctrl the function i wrote is ;
self.textWindow = wx.ListBox(bottomwin, -1, wx.DefaultPosition,(1000, 120), sampleList, style = wx.LB_SINGLE|wx.LB_ALWAYS_SB )
def clearBottomWindow_usingListCtrl(self,strMsg):
if self.window.textWindow.GetCount() > self.maxlines:
self.window.textWindow.Clear()
self.window.textWindow.Append(time.strftime("%b %d %H:%M:%S
"+strMsg,time.localtime()))
#self.window.textWindow.AppendText(strMsg)
else:
self.window.textWindow.Append(time.strftime("%b %d %H:%M:%S
"+strMsg,time.localtime()))
#self.window.textWindow.AppendText(strMsg)
Now what happening is when count reaches maxlines the whole items are deleted…
My probs are:
- any method to delete only a few number of items from the top of the list if using Listbox,
- why is that vertical scroll bar is not coming in linux?
- The Vscroll bar comes in windows but its default position is at d
top. I want the vertical scroll bar to comes down as when messages are
appended. Any method by which we can bring the scrolll bar down( like
the scroll bar of a textctrl)
Hoping to get a favourable reply. i am in this problem for a very long
time. Maybe itz a simple thing but i’m not able to figure it out
···
–
Regards,
Shine Anne