473,789 Members | 2,368 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python/wxPython Reducing memory usage.

I have previously posted a simple app I am working on, and while I love
python and wxWindows, after checking the memory usage on such a simple
app (system try application launcher) I see that it climbs to over
17mb! I have reduced all my imports to the bare workable minimum and
that just gets it under 17mb. Is there any way that I could compile or
optimize the my program and/or its memory usage?
(Note: I don't have a problem with making this program win32 specific,
as it already is only win32)
CODE:
#this section broken down soley for readability, normally one line
from wxPython.wx import wxMessageDialog ,wxFrame,wxMenu ,
wxBitmap,wxOK,w xID_ANY,wxID_EX IT,wxID_ABOUT,
wxBITMAP_TYPE_I CO,wxBITMAP_TYP E_PNG,wxMenuIte m,
wxPySimpleApp,w xTaskBarIcon,wx Icon,EVT_TASKBA R_RIGHT_UP,EVT_ MENU
#end

from os import startfile
from sys import exit

class MainWindow(wxFr ame):
def OnAbout (self, event):
m = wxMessageDialog ( self, " LUNCH Bar 0.1 \n"
" A launch bar written in Python using
wxWindows","Abo ut LUNCH", wxOK)
m.ShowModal()
m.Destroy
def OnExit (self, event):
self.tbi.Destro y()
exit()
def OnTrayRight (self, event):
self.PopupMenu( self.rhtmenu)
def OnLaunch (self, event):
print event.GetString ()
path = 'D:\Program Files\Mozilla Firefox\Firefox .exe'
startfile(path)
def __init__(self,p arent,id,title) :
wxID_FIREFOX = 1117
wxFrame.__init_ _(self,parent,w xID_ANY, title, size = (
200,100))
self.tbi = wxTaskBarIcon()
icon = wxIcon('package .ico',wxBITMAP_ TYPE_ICO)
self.tbi.SetIco n(icon, '')
self.rhtmenu = wxMenu()
icon = wxBitmap(name = 'ffico.png', type = wxBITMAP_TYPE_P NG)
item = wxMenuItem(pare ntMenu = self.rhtmenu, id = wxID_FIREFOX,
text='Firefox')
item.SetBitmap( icon)
self.rhtmenu.Ap pend(wxID_EXIT, "&Exit"," Terminate this program")
self.rhtmenu.Ap pend(wxID_ABOUT , "&About"," Information about this
program")
self.rhtmenu.Ap pendSeparator()
self.rhtmenu.Ap pendItem(item)
EVT_TASKBAR_RIG HT_UP(self.tbi, self.OnTrayRigh t)
EVT_MENU(self, wxID_ABOUT, self.OnAbout)
EVT_MENU(self, wxID_EXIT, self.OnExit)
EVT_MENU(self, wxID_FIREFOX, self.OnLaunch)
appwin = wxPySimpleApp()
frame = MainWindow(None , -1, "Small editor")
appwin.MainLoop ()

Jul 18 '05 #1
1 2526
Joe
On 8 Apr 2005 23:35:57 -0700, "lotmr" <st*********@gm ail.com> wrote:
Is there any way that I could compile or optimize the my program and/or its memory usage?
.... and ideally, if we could also reduce the size of the DLL, so that
it would only include the widgets actually used, it'd be even nicer.
(Note: I don't have a problem with making this program win32 specific,
as it already is only win32)


I don't have much experience with it, but is the PythonWin wrapper to
MFC horrible to use as compared to wxWidgets? If it's good enough and
you don't care about non-Windows platforms, you'll probably save a lot
of RAM and file footprint.

Joe.
Jul 18 '05 #2

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

Similar topics

13
9230
by: ulysses | last post by:
Hi,all I use wxPython make a bittorrent client. I find wxPython very slow and use many many memory. When app start, it need 19MB memory. I only use common GUI components. Python is a really good programming language. But how to do a small,smart, efficency GUI in win32,it's a big question. I need make GUI,core code is bittorrent code. I can't change it.it's
699
34255
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro capabilities, unfortunately. I'd like to know if it may be possible to add a powerful macro system to Python, while keeping its amazing syntax, and if it could be possible to add Pythonistic syntax to Lisp or Scheme, while keeping all of the...
4
5024
by: ulysses | last post by:
hi, I'm working in python 5 months. I think it's very cool language. I do a p2p python program GUI. First I make a software by wxpython. But I find wxpython use many many memory. Second I use PYQT. But memory use still big. But but but when I minimize the windows to taskbar, a fantasy something happened. memory use very very low when windows minimize.
21
2860
by: Glen Wheeler | last post by:
Hello all, My program uses many millions of integers, and Python is allocating way too much memory for these. I can't have the performance hit by using disk, so I figured I'd write a C extension to define a new type. Problem is, my C knowledge is years old and regardless of my attempts distutils will not recognise my installation of the MS compiler. I am thinking, is there any easier way to use a 5 or 6 bit integer in python? Even a...
8
2113
by: Sridhar R | last post by:
Hi, I am a little experienced python programmer (2 months). I am somewhat experienced in C/C++. I am planning (now in design stage) to write an IDE in python. The IDE will not be a simple one. I had an idea of writing the IDE in C/C++, as it is a big project, bcoz of the following 1. if python is used, then the memory required for running the IDE will be high.
10
3694
by: Andrew Dalke | last post by:
Is there an author index for the new version of the Python cookbook? As a contributor I got my comp version delivered today and my ego wanted some gratification. I couldn't find my entries. Andrew dalke@dalkescientific.com
8
16006
by: Greg Merideth | last post by:
I've written a basic windows service to provide some helper xml functions for my web methods and even thou the service is only about 1k lines long with 1 timer, its mem usage is 10m and its vm mem usage is 14! The same code written as a program that requires you to click on the menu options to fire off the events takes up 4/9mb. I've seen examples where calling SetProcessWorkingSetSize(hWnd, -1, -1); does the same thing as minimizing a...
22
5061
by: Glurt Wuntal | last post by:
I am a newbie with Python. It's a great language, but I would like to be able to present a simple gui menu for some of my scripts; something better than using 'raw_input' prompts. Any recommendations for a program that will allow me to create the gui screens? Something useable in Linux. thanks.
0
9663
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, 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...
0
10404
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
10195
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...
0
9979
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...
1
7525
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
5415
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...
0
5548
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3695
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2906
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.