wxPython TextCtrl - 奇怪的滚动行为 [英] wxPython TextCtrl - weird scrolling behavior

查看:215
本文介绍了wxPython TextCtrl - 奇怪的滚动行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个设置为多行的TextCtrl。我有一个函数

说,updateText(msg),它需要一些字符串并将其附加到

文本控件...


txtControl.AppendText(msg)


.....但是,如果我追加的文字会导致滚动

条出现/或滚动,因为文本很长,文本控件显示

为空白,直到你点击滚动条...然后出现文本。

有什么想法吗?这是一个sizer问题还是一个TextCtrl问题??


谢谢

I have a TextCtrl which is set to be multi-line. I have a function
say, updateText(msg), which takes some string and appends it to the
text control...

txtControl.AppendText(msg)

.....however, if the text that I am appending would cause the scroll
bars to appear/or scroll since the text is long the textcontrol appears
to be blank, until you click on the scroll bar...then the text appears.
Any ideas? is this is a sizer problem or a TextCtrl issue??

thanks

推荐答案

abcd写道:
abcd wrote:

我有一个TextCtrl设置为多行。我有一个函数

说,updateText(msg),它需要一些字符串并将其附加到

文本控件...


txtControl.AppendText(msg)


....但是,如果我追加的文字会导致滚动

条出现/或滚动,因为文本很长,文本控件显示

为空白,直到你点击滚动条...然后出现文本。

有什么想法吗?这是一个sizer问题还是一个TextCtrl问题?


谢谢
I have a TextCtrl which is set to be multi-line. I have a function
say, updateText(msg), which takes some string and appends it to the
text control...

txtControl.AppendText(msg)

....however, if the text that I am appending would cause the scroll
bars to appear/or scroll since the text is long the textcontrol appears
to be blank, until you click on the scroll bar...then the text appears.
Any ideas? is this is a sizer problem or a TextCtrl issue??

thanks



我不确定,但是您可以尝试在

文本控件上调用Refresh()方法,看看是否可以修复它。

Don''t know for sure, but you can try calling the Refresh() method on the
text control and see if that fixes it.


10月30日,2:52下午,John Salerno< johnj ... @ NOSPAMgmail.com写道:

不确定,但你可以尝试调用

上的Refresh()方法
On Oct 30, 2:52 pm, John Salerno <johnj...@NOSPAMgmail.comwrote:
Don''t know for sure, but you can try calling the Refresh() method on
the

文本控件,看看是否修复了它。
text control and see if that fixes it.



没有什么区别。不知道问题是什么,我想知道

如果是布局问题,因为这是我与wxPython的弱点。


sizerTextPanel =

wx.StaticBoxSizer(self.sizerTextPanel_staticbox,wx.HORIZONTAL)

sizerTextPanel .Add(self.textPane,1,wx.ALL | wx.EXPAND,2)

self.textPanel.SetAutoLayout(True)

self.textPanel.SetSizer(sizerTextPanel)

sizerTextPanel。(self.textPanel)

sizerTextPanel .SetSizeHints(self.textPanel)

sizerMainPanel.Add(self.textPanel,3,wx.ALL | wx.EXPAND,0)

不确定这是否意味着任何人都可以:)

Didn''t make a difference. Not sure what the problem is, I am wondering
if it is a layout issue since that is my weak spot with wxPython.

sizerTextPanel =
wx.StaticBoxSizer(self.sizerTextPanel_staticbox, wx.HORIZONTAL)
sizerTextPanel .Add(self.textPane, 1, wx.ALL|wx.EXPAND, 2)
self.textPanel.SetAutoLayout(True)
self.textPanel.SetSizer(sizerTextPanel )
sizerTextPanel .Fit(self.textPanel)
sizerTextPanel .SetSizeHints(self.textPanel)
sizerMainPanel.Add(self.textPanel, 3, wx.ALL|wx.EXPAND, 0)
not sure if that means anything to anyone :)


abcd写道:
abcd wrote:

sizerMainPanel.Add(self.textPanel ,3,wx.ALL | wx.EXPAND,0)
sizerMainPanel.Add(self.textPanel, 3, wx.ALL|wx.EXPAND, 0)



你最好的选择是发布到 wx ************ @ lists.wxwidgets.org


但是有一个问题来了记住,你不是将sizerTextPanel添加到

sizerMainPanel?我认为所有的子尺寸应该添加到主要的

sizer中,除非有一些我不知道的奇怪的原因。

如果您发布到wxPython邮件列表,您可能希望包含更多

的代码,以便我们可以看到更大的图片。

Your best bet may be to post to wx************@lists.wxwidgets.org

But one question that comes to mind is, do you not add sizerTextPanel to
sizerMainPanel? I think all sub-sizers should be added to the main
sizer, unless there''s some weird reason I don''t know of.

If you post to the wxPython mailing list, you might want to include more
of your code so we can see the bigger picture.


这篇关于wxPython TextCtrl - 奇怪的滚动行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆