473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

wxPython TextCtrl - weird scrolling behavior

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

Oct 30 '06 #1
10 4069
abcd wrote:
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
Don't know for sure, but you can try calling the Refresh() method on the
text control and see if that fixes it.
Oct 30 '06 #2
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.
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 :)

Oct 30 '06 #3
abcd wrote:
sizerMainPanel.Add(self.textPanel, 3, wx.ALL|wx.EXPAND, 0)
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.
Oct 30 '06 #4
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.
well i set the sizer on the textPanel and then I add the textPanel to
sizerMainPanel

Oct 30 '06 #5
abcd wrote:
>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.

well i set the sizer on the textPanel and then I add the textPanel to
sizerMainPanel
Ah, I see. Seems like it may be a sizer issue, since you are adding a
bunch of things together. I noticed that one object you refer to is
self.textPane, is that supposed to be self.textPanel?
Oct 30 '06 #6
On Oct 30, 3:47 pm, John Salerno <johnj...@NOSPAMgmail.comwrote:
>I noticed that one object you refer to is
self.textPane, is that supposed to be self.textPanel?
no, self.textPane is the actual wx.TextCtrl.

I used a GUI Builder to the layout stuff...perhaps that's my problem :)

is there a good site to refer to for how to use sizers? i am
essentially creating a chat window (textPane is the history of the
chat, then a textCtrl below it for typing a new message and a button
next to the input field and buttons below the input field).

Oct 30 '06 #7
abcd wrote:
On Oct 30, 3:47 pm, John Salerno <johnj...@NOSPAMgmail.comwrote:
>I noticed that one object you refer to is
self.textPane, is that supposed to be self.textPanel?

no, self.textPane is the actual wx.TextCtrl.

I used a GUI Builder to the layout stuff...perhaps that's my problem :)

is there a good site to refer to for how to use sizers? i am
essentially creating a chat window (textPane is the history of the
chat, then a textCtrl below it for typing a new message and a button
next to the input field and buttons below the input field).
After I watched the screencasts for how Dabo uses sizers, I really
understood them a lot better. I've never used Dabo itself for GUI
design, but the screencast, though it shows them in terms of that
program, still gives a great visual presentation of how sizers work in
general and I suggest you take a look at that:

http://leafe.com/screencasts/sizers1.html
http://leafe.com/screencasts/sizers2.html

P.S. I suggest you post the full code to the wxPython mailing list. I'll
take a look at it to see if anything strikes me, but also you will have
a ton of other (more experienced) people looking at it too, and I
guarantee they will spot your problem.
Oct 31 '06 #8
On Oct 31, 2006, at 3:22 PM, John Salerno wrote:
After I watched the screencasts for how Dabo uses sizers, I really
understood them a lot better. I've never used Dabo itself for GUI
design, but the screencast, though it shows them in terms of that
program, still gives a great visual presentation of how sizers work in
general and I suggest you take a look at that:

http://leafe.com/screencasts/sizers1.html
http://leafe.com/screencasts/sizers2.html
Thanks for the good feedback. It took me a while to wrap my brain
around sizers when I first started using them; now I hate working
without them!

Also, I wanted to mention that our visual Class Designer has another
helpful feature: you can right-click control to bring up a context
menu. One of the choices is 'Edit Sizer Settings...', which brings up
a dialog with all the relevant settings in one place. As you change
them in the dialog, the design surface updates so that you can see
the effect of your changes before you commit them. If you don't like
your changes, click 'Cancel' and things return to the way they were
before you started.

-- Ed Leafe
-- http://leafe.com
-- http://dabodev.com
Oct 31 '06 #9
thanks for the feedback, I am watching the screencasts, which are
helping already. I think I will try out the Dabo GUI tool since it
uses wxPython...and see if I can get the code I need from it.

thanks

Nov 1 '06 #10
On 1 Nov 2006 04:54:32 -0800, abcd <co*******@gmail.comwrote:
thanks for the feedback, I am watching the screencasts, which are
helping already. I think I will try out the Dabo GUI tool since it
uses wxPython...and see if I can get the code I need from it.
I think you'll be very impressed. Those guys are creating an excellent
tool, and I've found that I can create pretty complicated UIs in a
very, very short time with the Class Designer.

--

# p.d.
Nov 1 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Logan | last post by:
I asked a similar question already in the wxPython mailing list, but did not get an answer up to now: 1.) When using a TextCtrl with styles (color etc.) in wxPython, is it then possible to get a...
3
by: Lo?c Mah? | last post by:
Hello I try to use a Validator for a TxtCtrl placed in a Panel with a Button in order to trigger the Validator and test the content of TxtCtrl. I have looked into wxPython documentation and...
1
by: sillyemperor | last post by:
I was a new guy of Python,when i want to test my wxPython app by unittest,it couldn`t work.I fund a stubmaker.py but it only for wxDialog but all widgets.Can someone can tell me how test wxPython...
1
by: PeterG | last post by:
Hi, I am relatively new to Python, and am learning it as part of a university module... Im currently undertaking a project to create an IM server and IM gui client. I have a very basic...
5
by: citronelu | last post by:
I made a small wxPython app that retrieves web data; for visual logging I use a TextCtrl widget, and stdout is redirected to it, something like this: class RedirectOutput: def __init__(self,...
9
by: Tyler | last post by:
Hello All: I am currently working on a project to create an FEM model for school. I was thinking about using wxPython to gather the 12 input variables from the user, then, after pressing the...
1
by: Bailu | last post by:
Hi, I am a newbie in wxPython and doing a program with ListBox, I want to select and deselect items in this box, I have use self.devlist = wx.ListBox(self, style=wx.LB_MULTIPLE)...
1
by: aeroumr | last post by:
In the following code, I have created a panel with a button and a textctrl object on it. I have also created a menubar that will create a new text file (i.e. textctrl object). My problem is that...
4
by: Jimmy | last post by:
hi, all I'm having a problem with creating custom events in wxpython. I have a class A handling some data processing work and another class B of GUI matter. I need GUI to display information...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.