It seems to me that in my "again and again repainting canvas" script the
rendering is slowing down as the time goes.
It is visible even after 10 seconds.
Any idea why?
--
geon
The exception is rule. 4 3131
"pavel.kosi na" <ge**@post.cz > wrote: It seems to me that in my "again and again repainting canvas" script the rendering is slowing down as the time goes.
when you add an item to the canvas, it's part of the canvas
until you remove it. if performance drops, it's usually because
you keep adding new items without removing the old ones.
try adding a w.delete(ALL) call before you "repaint".
for better performance, you should restructure your code so
it modifies existing canvas items, when possible, rather than
deleting and recreating items all the time.
if you want a light-weight canvas, you might wish to look at http://effbot.org/zone/wck.htm
and especially http://effbot.org/zone/wck-3.htm
</F>
Fredrik Lundh napsal(a): when you add an item to the canvas, it's part of the canvas until you remove it. if performance drops, it's usually because you keep adding new items without removing the old ones.
try adding a w.delete(ALL) call before you "repaint".
In the meantime I found that widget.destroy( ) works well, too (before
"repainting ").
Thanks a lot
--
geon
Vyjímka je pravidlo. Rekurzivní.
On Sat, 28 May 2005 18:21:46 +0200, pavel.kosina <ge**@post.cz > wrote: Fredrik Lundh napsal(a): when you add an item to the canvas, it's part of the canvas until you remove it. if performance drops, it's usually because you keep adding new items without removing the old ones.
try adding a w.delete(ALL) call before you "repaint".
I noticed once that if this actually deletes all canvas items, it does not delete the bindings on them: every binding put on a canvas item registers a Python callable at tcl level, but does not associate it with the item. So deleting the item keeps the binding even if it cannot be called anymore. If you have many items with several bindings, this can cause the memory usage to grow up and slow down the canvas.
In the meantime I found that widget.destroy( ) works well, too (before "repainting ").
This was the only solution I found using "regular" Tkinter widgets when there are bindings on canvas items. I tried to find another solution by modifying Tkinter.py, but the problem is much harder than it seems, since many things happen at tcl level. However, I didn't investigate the WCK.
HTH
--
python -c "print ''.join([chr(154 - ord(c)) for c in 'U(17zX(%,5.zmz 5(17;8(%,5.Z65\ \'*9--56l7+-'])"
Eric Brunel wrote: In the meantime I found that widget.destroy( ) works well, too (before "repainting ").
This was the only solution I found using "regular" Tkinter widgets when there are bindings on canvas items. I tried to find another solution by modifying Tkinter.py, but the problem is much harder than it seems, since many things happen at tcl level.
for pure Tkinter, I recommend using bind classes to implement "controller s"
on the canvas level, using appropriate find functions to locate the individual
items, and dispatching via "trackers". see http://online.effbot.org/2004_09_01_....htm#wck-track
for some background (I guess it's time to write that "later article" I mention
in that article. if you cannot wait, feel free to steal the controller code from
the WCK).
</F> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Josh |
last post by:
Caution, newbie approaching...
I'm trying to come up with a very simple Tkinter test application that
consists of a window with a drop-down menu bar at the top and a grid
of colored rectangles filling the remainder of the window. Mind you,
this is a contrived test application to help me understand Tkinter and
Python, not an actual application yet. I've trivially subclassed
Tkinter.Canvas into ColorCanvas, added a bunch of ColorCanvases...
|
by: srijit |
last post by:
Hello,
Any idea - why the following code crashes on my Win 98 machine with
Python 2.3? Everytime I run this code, I have to reboot my machine.
I also have Win32all-157 installed.
from Tkinter import *
class App:
|
by: SeeBelow |
last post by:
Do many people think that wxPython should replace Tkinter? Is this
likely to happen?
I ask because I have just started learning Tkinter, and I wonder if I
should abandon it in favor of wxPython.
Mitchell Timin
--
"Many are stubborn in pursuit of the path they have chosen, few in
|
by: Russell E. Owen |
last post by:
I want to support execution of simple user-written scripts in a Tkinter
application. The scripts should be able to wait for data and such
without hanging the GUI (and without having to write the script as a
bunch of asynchronously called subroutines).
I decided to use Tkinter's wait_variable. I built a "script runner"
object that has suitable wait methods. Internally each of these methods
registers a callback that sets a variable when...
|
by: phil |
last post by:
Using Tkinter Canvas to teach High School Geometry
with A LOT of success.
My drawing gets very slow after a lot of actions.
For instance I have created code to rotate a set of objects
about a rotation point.
rotate 360 degrees starts to get slow
after 720 degrees its crawling.
| |
by: Andrew Trevorrow |
last post by:
Our app uses embedded Python to allow users to run arbitrary scripts.
Scripts that import Tkinter run fine on Windows, but on Mac OS X there
is a serious problem. After a script does "root = Tk()" our app's menus
are permanently changed in the following way:
- The top item in the application menu changes to "About Tcl & Tk...".
- The Quit item is disabled.
- The File and Edit menus are completely replaced.
- All further menus (except...
|
by: Michael Yanowitz |
last post by:
Hello:
Below I have included a stripped down version of the GUI I am working on.
It contains 2 dialog boxes - one main and one settings. It has the following
problems, probably all related, that I am hoping someone knows what I am
doing wrong:
1) Pressing the Settings.. Button multiple times, brings up many instances
of the Settings Panel. I just want it to bring up one. Is there an easy
way to do that?
|
by: Peter Pearson |
last post by:
Tkinter makes it very easy to drag jpeg images around on a
canvas, but I would like to have a "target" change color when
the cursor dragging an image passes over it. I seem to be
blocked by the fact that the callbacks that might tell the
target that the mouse has entered it (<Enter>, <Any-Enter>,
even <Motion>) aren't called if the mouse's button is down.
What am I missing? Have I failed to find the right Tkinter
document? Is Tkinter...
|
by: J-Burns |
last post by:
Hello. Im a bit new to using Tkinter and im not a real pro in
programming itself... :P. Need some help here.
Problem 1:
How do I make something appear on 2 separate windows using Tkinter? By
this I mean that the format would be something like this:
You have Page1 : This has 2-3 buttons on it.
Clicking on each button opens up a new window respectively having
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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,...
| |
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...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |