473,976 Members | 1,446 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Tkinter uses a lot of memory?!

Hi there,

I wrote my first Python program this weekend, Conway's Game of Life,
and I used Tkinter for the graphics. I thought I had done something
wrong when I saw the memory consumption, so I wrote the simplest Tk
program I could, and yep, it takes about 40MB of memory! I'm using Red
Hat Linux 9.0 and recent versions of the software. Please look at the
output below, and tell me if I am confused...

~/python: cat /etc/redhat-release
Red Hat Linux release 9 (Shrike)

~/python: rpmquery python
python-2.2.2-26

~/python: rpmquery tk
tk-8.3.5-88

~/python: rpmquery tkinter
tkinter-2.2.2-26

~/python: cat hello.py
#!/usr/bin/python
import Tkinter as Tk
root = Tk.Tk()
Tk.Button(text= 'Quit', command=root.qu it).pack()
root.mainloop()

~/python: python hello.py &
[1] 25633

~/python: ps u
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
sjm 23897 0.0 0.2 4980 1088 pts/0 S 12:18 0:00 -csh
sjm 25633 4.8 7.2 41576 37352 pts/0 S 22:35 0:00 python
hello.py
sjm 25634 0.0 0.1 2616 660 pts/0 R 22:35 0:00 ps u
Jul 18 '05 #1
2 2198
ServantOfTheSec retFire wrote:
wrong when I saw the memory consumption, so I wrote the simplest Tk
program I could, and yep, it takes about 40MB of memory! I'm using Red
Hat Linux 9.0 and recent versions of the software. Please look at the
output below, and tell me if I am confused... sjm 25633 4.8 7.2 41576 37352 pts/0 S 22:35 0:00 python

Can't say about linux, but on windows your program takes about 5.5MB.

--
--
Every sufficiently advanced magic is indistinguishab le from technology
- Arthur C Anticlarke
Jul 18 '05 #2
se************* *******@fea.st (ServantOfTheSe cretFire) wrote in message news:<f2******* *************** ****@posting.go ogle.com>...
Hi there,

I wrote my first Python program this weekend, Conway's Game of Life,
and I used Tkinter for the graphics. I thought I had done something
wrong when I saw the memory consumption, so I wrote the simplest Tk
program I could, and yep, it takes about 40MB of memory! I'm using Red
Hat Linux 9.0 and recent versions of the software. Please look at the
output below, and tell me if I am confused...
Wow!
~/python: cat /etc/redhat-release
Red Hat Linux release 9 (Shrike)
Suse 8.2
~/python: rpmquery python
python-2.2.2-26
rpm -qf $(which python)
python-2.2.2-82
~/python: rpmquery tk
tk-8.3.5-88
rpm -q tk
tk-8.4.2-27
~/python: rpmquery tkinter
tkinter-2.2.2-26
rpm -q python-tk
python-tk-2.2.2-92
~/python: cat hello.py
#!/usr/bin/python
import Tkinter as Tk
root = Tk.Tk()
Tk.Button(text= 'Quit', command=root.qu it).pack()
root.mainloop()

~/python: python hello.py &
[1] 25633

~/python: ps u
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
sjm 23897 0.0 0.2 4980 1088 pts/0 S 12:18 0:00 -csh
sjm 25633 4.8 7.2 41576 37352 pts/0 S 22:35 0:00 python
hello.py
pac 2947 1.6 2.1 11216 5556 pts/1 S 21:24 0:00 python
sjm 25634 0.0 0.1 2616 660 pts/0 R 22:35 0:00 ps u


I suppose all can suggest is that you do a lsof | grep sjm and spent
some time working out what shared libraries have been pulled in.

Regards, Paul Clinch
Jul 18 '05 #3

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

Similar topics

2
3559
by: Thomas | last post by:
I was used to pass Unicode strings to Tk widgets. IIRC, Tcl/Tk expects UTF-8 encoded strings, but Tkinter took care of that. This worked, as long as I was using Python/Tk on Red Hat 9 Linux (and on earlier versions). Now I switched to Fedora Core 1 Linux (where Python/Tk does not work without fixing it - but I described that in another thread) and I have to pass UTF-8 encoded strings to Tk widgets (i.e. I cannot directly pass Unicode...
3
2361
by: Mickel Grönroos | last post by:
Hi everybody, I'm using QuickTimeTcl (3.1) to be able to play movie files in my Tkinter application (Python 2.3.2) on Windows 2000. I was planning to write a simple wrapper class, QuickTimeMovie, that would wrap up the QuickTimeTcl Tcl extension as a Python class. All seems to work pretty fine until the Tkinter application is closed, when the Python interpreter crashes with an error of the following kind: The instruction at...
2
3263
by: Paul A. Wilson | last post by:
I'm new to Tkinter programming and am having trouble creating a reusable button bar... I want to be able to feed my class a dictionary of button names and function names, which the class will make. My button bar is implemented a Frame subclass, which takes the button dictionary as an argument and displays the buttons on the screen: class OptionsBar(Frame): def __init__(self, buttonDict, parent=None) Frame.__init__(self, parent)
2
3655
by: Elbert Lev | last post by:
#When I'm running this script on my windows NT4.0 box, #every time dialog box is reopened there is memory growth 384K. #Bellow is the text I sent to Stephen Ferg (author of easygui) # I have tested the pure Tkinter, # by modifiing on of the examples in the distribution. # This little guy also exibits the same behaviour. # Namely: every time the window is closed and reoppend, # there is memory leak of several hundreds 384K
0
1490
by: aditya.siram | last post by:
Hi all, I recently found the Leo Outliner Tool (http://webpages.charter.net/edreamleo/front.html)written in Python and installed it on my Windows PC at work and my Debian and Ubuntu PC's at home. On my Linux installs, however, the application is jumpy. When scrolling down a long document in Leo, the redraw rate lags behind significantly as though the system is running out of memory. On Windows the scrolling is smooth and seamless. I...
3
2662
by: frikk | last post by:
Hey everyone. I have been working with python for a couple years now, but just recently built my first program with a GUI. I decided to start with Tkinter since it is included with the base package, although wxWindows will likely be my next choice. Tkinter seems to be pretty slow for my needs. Anyway - I am building a genetic algorithm simulator. I have a grid where an Ant moves around. It is infeasible for me to update the grid...
0
1559
by: wolfonenet | last post by:
Hi All, My setup is: WinXP Python 2.5.1 TKinter version: $Revision: 50704 $ Tcl: 8.4 Debugger: WinPdb
11
3589
by: Kenneth McDonald | last post by:
Any guesses as to how many people are still using Tkinter? And can anyone direct me to good, current docs for Tkinter? Thanks, Ken
3
3000
by: joshdw4 | last post by:
I hate to do this, but I've thoroughly exhausted google search. Yes, it's that pesky root window and I have tried withdraw to no avail. I'm assuming this is because of the methods I'm using. I guess my question is two-fold. 1) How do I get rid of that window? 2) Any comments in general? I am just learning python (and coding with classes), so I'm sure there are things I should pound into my head before I learn bad habits. Here's the...
0
11811
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
11404
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
11566
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
10903
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
10078
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
8454
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
7601
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();...
0
6411
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...
2
4727
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.