473,770 Members | 4,029 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1897
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"*10000 0 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.or g" 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 misunderstandin g 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.o rg> 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 misunderstandin g 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.o rg> 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 misunderstandin g 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.or g> 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"*10000 0 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
1301
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 parameter will be used to pass in a xml document text stored in db, the text contents (about 200 of these guys total) are stored in a cached static variable. My web app must be thread-safe, so I cannot create and cache 200 XmlDocument objects...
65
12610
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 method was a piece of C code which turned out to be incorrect and incomplete but by modifieing it would still be usuable. The first method was this piece of text:
0
1189
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 information, I use controls inheriteds from ListView with updated styles (this.SetStyle(ControlStyles.ContainerControl | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint | ControlStyles.DoubleBuffer | ControlStyles.UserPaint |...
0
1106
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.) Account used for anonymous access: User name: IUSR_PC-JACK-LP Password: xxxxxx
2
1806
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 problem is that the application is rather slow at painting the buttons. Ideally I wanted to allow the user to re-size the control and change the text and style of the buttons without such rendering issues. (I have a tool to re-size the buttons,...
8
3271
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 - about 10-15 seconds...I want to make the code faster. I changed it to be multi-threaded, and it doesn't really make it any faster. The bottleneck seems to be with the math computations. Any ideas like changing my data types or other ideas etc would...
41
2698
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 will calculate the factorial of 10, 10 millions time and print the reusult in a file with the name log.txt.. I wrote something like this
8
2410
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 c++ is currently compiled with the /clr flag meaning that nothing is compiled native. I've seen some examples where wrapping arithmetically intense code with "pragma unmanaged" results in increased performance, but this was in test code with...
6
7974
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, there is a ETL which deletes most of the data in the database and fills it all new. We observed very bad performance for some statements that ran for minutes (The queried table is about 100,000 records and the result is about 500 rows)....
0
9439
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10237
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10071
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10017
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9882
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8905
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7431
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
2832
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.