473,406 Members | 2,369 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,406 software developers and data experts.

Faster GUI text control

Hi,
I wrote a program for work that processed and formatted some
collected text data in a Tkinter based GUI display. I've found that as
my data files get longer (a few thousand lines), there seems to be a
real lag when it comes to clearing or updating the Text control, enough
so that the program just isn't useful. I poked around some and saw
several people mention that is was a known issue with Tkinter.
I'm trying to decide what is the best replacement for the control. I
was originally planning on redoing the GUI with wxpython, but I've seen
people indicate I would have the same problem. I also was looking at
Fredrik Lundh's widget construction kit info. That looks like it could
be useful, but it would still require building a new control and I'm not
sure if it would solve my base problem. I'm still pretty inexperienced
with Python, so I'd like to concentrate on using a working text control
and writing the data processor part of my program rather than writing
and debugging a text control to use. Does anyone have any
recommendations they could share? Thanks very much.
Jul 19 '05 #1
8 1867
On Fri, 13 May 2005 15:44:24 -0500, none wrote:
I'm trying to decide what is the best replacement for the control. I
was originally planning on redoing the GUI with wxpython, but I've seen
people indicate I would have the same problem.


Honestly, if this is important to you, the best thing to do is try all the
ones relevant to your platform; generally creating a window with a text
widget and loading it with "a whole lotta text", as appropriate to your
app, is fairly easy; it is not true that once you've tried one GUI toolkit
you've tried them all, but each one is easier than the last, and
generally, you can:

* Use the tutorial up to where they place a widget.

* Jump to the reference manual where they describe the text widget and
insert it instead.

* Fill the widget with a bunch of text. ("some string\n"*100000 or
something works well.)

* Start the program and go.

Not counting downloading, an hour each, tops. (The only tricky one that I
am aware of is that GTK insists that text widgets have to be in a Scrolled
Window to get a scrollbar on them.)

The problem is that if you're really looking for performance, it may
differ based on the characteristics of the text and the quality of the
target computer, the platform (which you don't mention; GTK may scream in
Linux and make you scream in Windows...), etc., and there may be no one
person who can give you a firm "This is the best solution for your
situation" answer.
Jul 19 '05 #2
Jeremy Bowers wrote:
The problem is that if you're really looking for performance, it may
differ based on the characteristics of the text and the quality of the
target computer, the platform (which you don't mention; GTK may scream in
Linux and make you scream in Windows...), etc., and there may be no one
person who can give you a firm "This is the best solution for your
situation" answer.


Also, it must be said that thousands of lines of text in a GUI control
may not be necessary. Do the users really need to be able to scroll
through that much text all at once in the general case, or do they
perhaps only ever need to see the last few dozen lines? Could they
instead "page" through the text in swallowable morsels, say a couple
hundred lines at a time?

Python can handle gargantuan amounts of text with little noticable
performance penalty, while GUI controls aren't necessarily designed for
that. What I'm getting at is that you could still have the entire string
in memory, but only feed portions of that string to the GUI text control
at a time.

I'm jumping in here - perhaps the OP already told us what the
application is, but I'm curious why it is necessary to have thousands of
lines displayed and editable all at once, and wonder if the design
should be reconsidered. I know that native Windows controls in
particular tend to get really squirrly and unpredictable once you push
into thousands of lines.

--
pkm ~ http://paulmcnett.com

Jul 19 '05 #3
"none "@bag.python.org" wrote:
several people mention that is was a known issue with Tkinter.
I'm trying to decide what is the best replacement for the control. I
was originally planning on redoing the GUI with wxpython, but I've seen
people indicate I would have the same problem. I also was looking at
Fredrik Lundh's widget construction kit info. That looks like it could
be useful, but it would still require building a new control


no, it would mean writing some python code. if all you need is a scrolling
text list, you can simply use the code on this page:

http://effbot.org/zone/wck-4.htm

(see "A scrollable list view, with scrollbar support" and, optionally,
the virtual data modifications under "Displaying Huge Data Sets")

the resulting widget will update at constant speed, independent of the
data size.

</F>

Jul 19 '05 #4
>
no, it would mean writing some python code. if all you need is a scrolling
text list, you can simply use the code on this page:

http://effbot.org/zone/wck-4.htm

(see "A scrollable list view, with scrollbar support" and, optionally,
the virtual data modifications under "Displaying Huge Data Sets")

the resulting widget will update at constant speed, independent of the
data size.

</F>


Thanks for the suggestion. I looked at that, but I need to be able to
selectively change colors on parts of the text and I didn't think I
could do that with a list box. Am I misunderstanding that?
Jul 19 '05 #5
That's a good point about the amount of text available at once. As
long as I could swap the visible section fast enough that might be a
good solution.
This will run mostly on Windows, but I'd like for it to be equally
usable on Linux.
Jul 19 '05 #6
"none <"@bag.python.org> wrote:
no, it would mean writing some python code. if all you need is a scrolling
text list, you can simply use the code on this page:

http://effbot.org/zone/wck-4.htm

(see "A scrollable list view, with scrollbar support" and, optionally,
the virtual data modifications under "Displaying Huge Data Sets")

the resulting widget will update at constant speed, independent of the
data size.

</F>


Thanks for the suggestion. I looked at that, but I need to be able to
selectively change colors on parts of the text and I didn't think I
could do that with a list box. Am I misunderstanding that?


yes. the list view isn't a listbox, it's a new widget.

with the list view, you control the drawing yourself, and can draw things
in whatever way you want. (the section "Non-Standard Rendering" talks
about this; reading http://effbot.org/zone/wck-3.htm also helps).

</F>

Jul 19 '05 #7
Fredrik Lundh wrote:
"none <"@bag.python.org> wrote:

no, it would mean writing some python code. if all you need is a scrolling
text list, you can simply use the code on this page:

http://effbot.org/zone/wck-4.htm

(see "A scrollable list view, with scrollbar support" and, optionally,
the virtual data modifications under "Displaying Huge Data Sets")

the resulting widget will update at constant speed, independent of the
data size.

</F>


Thanks for the suggestion. I looked at that, but I need to be able to
selectively change colors on parts of the text and I didn't think I
could do that with a list box. Am I misunderstanding that?

yes. the list view isn't a listbox, it's a new widget.

with the list view, you control the drawing yourself, and can draw things
in whatever way you want. (the section "Non-Standard Rendering" talks
about this; reading http://effbot.org/zone/wck-3.htm also helps).

</F>

Thanks for the clarification. I'm going to go back and read the
"Writing widgets" articles in detail.
Jul 19 '05 #8
In article <pa****************************@jerf.org>,
Jeremy Bowers <je**@jerf.org> wrote:
On Fri, 13 May 2005 15:44:24 -0500, none wrote:
I'm trying to decide what is the best replacement for the control. I
was originally planning on redoing the GUI with wxpython, but I've seen
people indicate I would have the same problem.


Honestly, if this is important to you, the best thing to do is try all the
ones relevant to your platform; generally creating a window with a text
widget and loading it with "a whole lotta text", as appropriate to your
app, is fairly easy; it is not true that once you've tried one GUI toolkit
you've tried them all, but each one is easier than the last, and
generally, you can:

* Use the tutorial up to where they place a widget.

* Jump to the reference manual where they describe the text widget and
insert it instead.

* Fill the widget with a bunch of text. ("some string\n"*100000 or
something works well.)

* Start the program and go.

Not counting downloading, an hour each, tops. (The only tricky one that I
am aware of is that GTK insists that text widgets have to be in a Scrolled
Window to get a scrollbar on them.)

The problem is that if you're really looking for performance, it may
differ based on the characteristics of the text and the quality of the
target computer, the platform (which you don't mention; GTK may scream in
Linux and make you scream in Windows...), etc., and there may be no one
person who can give you a firm "This is the best solution for your
situation" answer.


The known Tkinter symptoms, incidentally, have more to do with
*removing* content from a text than adding them. Any exercises,
therefore, should not only load data into a text or near-text,
but also remove them.
Jul 19 '05 #9

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

Similar topics

1
by: Zeng | last post by:
Hello, I have profiled my code, and the current performance bottleneck is this routine. It gets called 7400 times to do some intensive calculations when a user uses the feature. The xmlText...
65
by: Skybuck Flying | last post by:
Hi, I needed a method to determine if a point was on a line segment in 2D. So I googled for some help and so far I have evaluated two methods. The first method was only a formula, the second...
0
by: Víctor | last post by:
Hello, I'm doing a Intranet application which shows some information panels dinamically. Each panel is a dll loaded dinamically using Reflection and inherits from Panel class. To display...
0
by: Jack Wright | last post by:
Dear All, The following is the setting on IIS on a typical Client Server we are working on Authentication Methods Anonymous access (No user name/password required to access this resource.) ...
2
by: Carl Gilbert | last post by:
Hi I am developing a custom on screen keyboard. So far I have an array of buttons and then using SendKeys to send the text of the button to the active control to receive the text. The only...
8
by: Scott Emick | last post by:
I am using the following to compute distances between two lat/long coordinates for a store locator - (VB .NET 2003) it seems to take a long time to iterate through like 100-150 locations -...
41
by: c | last post by:
Hi every one, Me and my Cousin were talking about C and C#, I love C and he loves C#..and were talking C is ...blah blah...C# is Blah Blah ...etc and then we decided to write a program that...
8
by: Henri.Chinasque | last post by:
Hi all, I am wondering if there are any quick/efficient ways to look at a piece of c++ code and determine if it would run faster if it was compiled to native code. I ask this because all of my...
6
by: =?ISO-8859-1?Q?Tim_B=FCthe?= | last post by:
Hi, we are building a Java webapplication using JSF, running on websphere, querying a DB2 9 on Suse Enterprise 10. The app uses JDBC and PreparedStatements only (aka dynamic SQL). Every night,...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.