472,353 Members | 1,386 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

How to accelerate python application GUI speed

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
really good code.

I read book 'Python Programming on Win32' ,I get following idea. I
test it.

1. Use wxpython ,it's successful,but very slow .

2. use python for delphi. I test it, but it need embed python code to
delphi. So need
change original code.Actually I don't know how to change .it's big
project.

3. User win32com, make a com server by delphi. com server have form.
make python code
as com client. I make a com server and invoke the server by
pythonwin. but the form
can't show. :( anyone do it ,could you share you code to world.

4. use pythonwin. mfc or win32gui framework. I check the demo code,
it's very complex.
you know I hate MFC. it's a joke. i like VCL so much.

5. I have a another idea. use wxWindows (c lan) build a GUI. embed
python code .
or embed wxWindows code to python by SWIG. I have't test it. if you
have do it.
Please tell us.

Thanks.

Ulysses
ul********@yahoo.com.cn
Jul 18 '05 #1
13 8883
ul********@yahoo.com.cn (ulysses) writes:
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.


An solution is to make a web application and use a tiny browser like
kmeleon.

bye

--
William Dode - http://flibuste.net
Jul 18 '05 #2
ul********@yahoo.com.cn (ulysses) writes:
[...]
Python is a really good programming language. But how to do a
small,smart, efficency GUI in win32,it's a big question.
http://venster.sourceforge.net/

[...] 4. use pythonwin. mfc or win32gui framework. I check the demo code,
it's very complex. you know I hate MFC. it's a joke. i like VCL so
much.
Well, if you hate win32 also, then you won't like venster.

5. I have a another idea. use wxWindows (c lan) build a GUI. embed
python code . or embed wxWindows code to python by SWIG. I have't
test it. if you have do it. Please tell us.


Interesting idea.
John
Jul 18 '05 #3
Wilk <wi******@OUTflibuste.net> writes:
ul********@yahoo.com.cn (ulysses) writes: [...] An solution is to make a web application and use a tiny browser like
kmeleon.


Or MSIE, possibly using HTA.
John
Jul 18 '05 #4
On Wed, 03 Sep 2003 06:32:42 -0700, ulysses wrote:
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. [snip] 5. I have a another idea. use wxWindows (c lan) build a GUI. embed
python code .
or embed wxWindows code to python by SWIG. I have't test it. if you
have do it.
Please tell us.


Swig is how wxPython works already. If you wanted to do the whole gui in
C++, and just have python launch the code, you can do an extension pretty
easily, see my wiki entry here:
http://wiki.wxpython.org/index.cgi/C_2b_2bExtensions
(I'm not sure that this will make any difference wrt memory usage though.)
I think that letting C++ "drive" your code will be a significantly greater
time investment, I'm not sure how much of an effort it is to get the
python mainloop and the wxWin mainloop to work together, but since it is
already done for me with wxPython, I don't think I'll go trying to find
out either :-)

-Mark
Jul 18 '05 #5
ulysses wrote:
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.


In my opinion, the Qt toolkit is far better in terms of quality and speed
than wx/tk/whatever. It's also dead simple to code for. The Python
bindings are here: <URL:http://www.riverbankcomputing.co.uk/pyqt/>.

Check out the license first, some people don't like any of the choices
available.
--
Jim Dabell

Jul 18 '05 #6
You will always take a hit using threading and a gui. I agree with your
complaints about wxPython's size though. I'm not quite sure what you
mean by wxPython is "slow" though. Do you mean that running your code
inside wxPython is slow?

Qualitatively, when using wxPython and QT I've encountered about a 30%
speed hit when using threads.

I'll assume that your bit-torrent code has a pretty simple interface,
such as "download this file to here", "I'm X percent done" and "cancel
the download"

If this is the case, you might be interested in using wxProcess to spawn
a new python process and then monitor the new processes stdout to update
a progress bar or a dialog box.

The benefits are as follows:
1) Easy to kill a process.
2) The process doesn't get blocked by the GIL and can run with (just
about) full CPU power.

Downsides:
1) python needs to be in your path and the python path has to be
set up correctly to load your code.
2) wxProcess doesn't work on OS X yet.

My code is pretty ugly, but I am using it in a production environment.
Let me know if you want me to post it here (it comes with an example).

--
Brian Kelley bk*****@wi.mit.edu
Whitehead Institute for Biomedical Research 617 258-6191

Jul 18 '05 #7
jj*@pobox.com (John J. Lee) writes:
Wilk <wi******@OUTflibuste.net> writes:
ul********@yahoo.com.cn (ulysses) writes:

[...]
An solution is to make a web application and use a tiny browser like
kmeleon.


Or MSIE, possibly using HTA.


What is HTA ? I thought about an HTTPServer that could work with any
browser.

--
William Dode - http://flibuste.net
Jul 18 '05 #8
| What is HTA ?

Wilk ....

HTA ... HTML Application

http://msdn.microsoft.com/workshop/a...bjects/hta.asp

Example containing a bit of VBScript
to access some common applications
under Windows ...

http://fastq.com/~sckitching/HTML/Start_Page.hta

--
Cousin Stanley
Human Being
Phoenix, Arizona
Jul 18 '05 #9
| But you can use Python just as easily.
|
| <script language="Python">
| ...
| </script>

John ....

I did that example HTA using VBScript about 3 years ago
before I even knew that Python existed and just posted it
as a handy example to illustrate basically what a local
HTA could do ....

It would be WAY cooler to do it in Python,
and now that I know it's possible I'll try it ....

--
Cousin Stanley
Human Being
Phoenix, Arizona
Jul 18 '05 #10
Thanks to all.

To:John J.Lee
I download 'venster' and test a small samples. I think it's good idea
for python GUI.
I has use MFC, but I don't like MFC framework. but I like VENSTER's
way. I only need
make GUI by VC. and write code in python . that code very clear and
obvious. I'll test
for complete project. anyone has make project to do it? thank you.

To: Mark Roach

I has read this article. It's same as my idea. But the code sample is
make a foo button
in wxWindows ,use swig link to wxpython. I don't know if I make a frame
in wxWindows.
Can I use it in wxPython. Who test it? thank you.

To:Jim Dabell

I download pyQt ,But I hasn't test it. QT is C++ GUI framework. It's
very cool too.

To:Brian Kelley

sorry about my poor english.
I say 'slow'. It's mean wxPython application start up very slow and use
big memory.
core python code very quick. I use thread. Because Bit-torrent is a P2P
program.
it's have many intercurrent internet connection for download and
upload.
I'll assume that your bit-torrent code has a pretty simple interface,
such as "download this file to here", "I'm X percent done" and "cancelthe download"

~~~~~ you are right. I only need get these information from bit-torrent
..
It's use a function to communicate with GUI and core program.

If you should post you code . I very thank you. I like study with you.
thank you.

To:Harobed
I didn't test pyGTK. thank you.
You know I very care speed and use in WIN32,I hear GTK very slow.

my BitTorrent client (ourbt) download address

ftp://ourbt:ou***@211.90.187.42:2111/ourbtsetupen.exe

After you use it,you will know what i need. :)

Ulysses
Jul 18 '05 #11
On Wednesday 03 September 2003 07:32 am, ulysses wrote:
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.


Another option is to use Venster, which is based on ctypes. It'll have a
pretty small memory and disk footprint (relatively speaking). It's not as
mature or high-level as wx though, but if you're more or less familiar with
Win32 GUI programming it's pretty straightforward.

If the GUI is pretty simple (a few dialog boxes) then you could just build the
dialogs in something like Visual Studio and store them in a resource DLL, and
then use Win32 calls to display them. You could also build the dialogs on the
fly using Win32 calls (ctypes or win32all, although win32all has some nice
helper routines - look at win32ui.CreateDialogIndirect for more info).

-Dave

Jul 18 '05 #12
I have put up the source code on my projects page. You can find it at
the bottom of the path here:

http://jura.wi.mit.edu/people/kelley/

Here is a bit of the description:

Are you annoyed that using python threads slows down your progam by
about 30% because of the GIL (Global Interpreter Lock)?

The code described here give you another option! You can run and
monitor a python script running in a seperate process. This is very
coarse grained threading but the spawned process can run at (just about)
full speed. You can also kill the process as well.

The process can also send rudimentary data back to the monitoring
application. This includes raw python datatypes and pickled items can
be transferred back to the monitoring application.

The usage is fairly simple:
pythonscript a python script in a text string.

dlg = ProcessDlg(parent, title, pythonscript)
dlg.Destroy()

Warning, the code hasn't been tested under linux/unix.
Enjoy.

Jul 18 '05 #13
ul********@yahoo.com.cn (ulysses) wrote in message news:<43**************************@posting.google. com>...
Finally. I use PyQt build my new GUI. PyQt is good framework.
But It isn't free. Anybody give QT education version. I can't
download it from trolltech. QT non commercial version have some
restriction. I build freeware why I can only get the limit non
commercial version. :(


This is not supported. If you don't work for an university forget about QT.
Pay or use something else - so is life. Why should they give away there
work for free, just because you want to do the same ?
Jul 18 '05 #14

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

Similar topics

467
by: mike420 | last post by:
THE GOOD: 1. pickle 2. simplicity and uniformity 3. big library (bigger would be even better) THE BAD:
52
by: Neuruss | last post by:
It seems there are quite a few projects aimed to improve Python's speed and, therefore, eliminate its main limitation for mainstream acceptance. I...
114
by: Maurice LING | last post by:
This may be a dumb thing to ask, but besides the penalty for dynamic typing, is there any other real reasons that Python is slower than Java? ...
9
by: Dieter Vanderelst | last post by:
Dear all, I'm currently comparing Python versus Perl to use in a project that involved a lot of text processing. I'm trying to determine what the...
50
by: diffuser78 | last post by:
I have just started to learn python. Some said that its slow. Can somebody pin point the issue. Thans
8
by: . | last post by:
What is the fast way for a fast implementation of Python? -- JavaScript implementation of Python http://groups.google.it/group/JSython/
4
by: wang frank | last post by:
Hi, While comparing the speed of octave and matlab, I decided to do a similar test for python and matlab. The result shows that python is slower...
0
by: Kurt Mueller | last post by:
Am 08.10.2008 um 06:59 schrieb Hendrik van Rooyen: OK, this is gives an impression of SPEED. In your application the REAL-TIME...
2
by: mh | last post by:
I've got some python xmlrpc servers and clients. What's the best way to accelerate them? xmlrpclib.py attempts to import these modules: import...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.