473,803 Members | 4,157 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Python in a desktop environment

If you had an application that you were about to begin development on
which you wanted to be cross platform (at least Mac and Windows),
would you suggest using c++ and Python?

I'm asking because we were originally thinking about doing c# but
after attending PyCon this year I'm reconsidering. We are already
using Python for the website and I figure a c++ backend w/ a Python
GUI may work really well, and would be pretty easy to port.

Any opinions?

Mar 11 '07 #1
31 2014
On Mar 10, 9:23 pm, "David Cramer" <dcra...@gmail. comwrote:
If you had an application that you were about to begin development on
which you wanted to be cross platform (at least Mac and Windows),
would you suggest using c++ and Python?
Depending on what exactly you're trying to do, a pure python solution
may be sufficient, though obviously a C/C++ backend would be portable
as well. In terms of GUI; GTK or QT would probably be your best bet
(my personal preference is for pygtk), though Wxidgets may be a viable
option if the others are not (I'm not sure how advanced GTK/QT support
is on OSX). Your question is kind of vague, so this response is vague
as well. More info is needed to answer in a more specific way.

Regards,
Jordan

Mar 11 '07 #2
David Cramer wrote:
If you had an application that you were about to begin development on
which you wanted to be cross platform (at least Mac and Windows),
would you suggest using c++ and Python?
I'd strongly consider a pure python solution (I'd choose wxpython),
but if I needed to code backend stuff in a lower level language I'd
use C rather than C++.

Mar 11 '07 #3
On Mar 10, 10:52 pm, "sjdevn...@yaho o.com" <sjdevn...@yaho o.com>
wrote:
David Cramer wrote:
If you had an application that you were about to begin development on
which you wanted to be cross platform (at least Mac and Windows),
would you suggest using c++ and Python?

I'd strongly consider a pure python solution (I'd choose wxpython),
but if I needed to code backend stuff in a lower level language I'd
use C rather than C++.
Well we want it to be very robust, and python isn't exactly the
fastest language, or one with the lowest overhead :)

Mar 11 '07 #4
Hi,

I'm relatively new to Python but have lots of prior programming experience
as a developer, instructor, and author (ASP/VBScript/SQL Server and
Clipper.)

I'm trying to write an app that parses a text file containing an outline
useing essentially the same indentation rules as Python source code, i.e.
the first level has no indent, the second level has one indent, third level
has two indents, and so on. However, I can't know for sure that the
indentations are tabs or spaces, or even mixed tabs and spaces. What's
more, I can't know for sure what tab spacing the persons editor was using if
they saved as spaces, i.e. tab='N' spaces where N= (2,3,4,5,6,7,8, ...)

Clearly the source code for Python has to figure this out, but I wonder if
anyone knows how to do this in Python. Frankly I'm stumped on how to find an
elegant algorithm that does require multipass parsing and lots of code. Any
help would be appreciated.

--
-Mike Schinkel
http://www.mikeschinkel.com/blogs/
http://www.welldesignedurls.org
http://atlanta-web.org - http://t.oolicio.us


Mar 11 '07 #5
David Cramer schrieb:
On Mar 10, 10:52 pm, "sjdevn...@yaho o.com" <sjdevn...@yaho o.com>
wrote:
>David Cramer wrote:
>>If you had an application that you were about to begin development on
which you wanted to be cross platform (at least Mac and Windows),
would you suggest using c++ and Python?
I'd strongly consider a pure python solution (I'd choose wxpython),
but if I needed to code backend stuff in a lower level language I'd
use C rather than C++.

Well we want it to be very robust, and python isn't exactly the
fastest language, or one with the lowest overhead :)
Erm, and what has _robustness_ with fast & less overhead to do? It's
exactly the other way round, a python program is much less likely to
crash that C/C++, and if so in manners that are much easier to manage
and fix.

I've done extensive GUI-development with PyQt, and can say that it's a
very productive and powerful combination. And GUI-code usually isn't
troublesome performance-wise.

Diez
Mar 11 '07 #6
"David Cramer" <dc*****@gmail. comwrote:
On Mar 10, 10:52 pm, "sjdevn...@yaho o.com" <sjdevn...@yaho o.com>
wrote:
>David Cramer wrote:
If you had an application that you were about to begin development on
which you wanted to be cross platform (at least Mac and Windows),
would you suggest using c++ and Python?

I'd strongly consider a pure python solution (I'd choose wxpython),
but if I needed to code backend stuff in a lower level language I'd
use C rather than C++.

Well we want it to be very robust, and python isn't exactly the
fastest language, or one with the lowest overhead :)
So if you want it to be robust it's a no brainer: Python and no C++ or C.

I'd advise you to start off doing it in pure Python, then when you get it
working see if it is fast enough, and if not profile it and find the
bottlenecks. Those bits which really do need speeding up you should then
rewrite using Pyrex, which won't take long at all since it is basically the
same syntax. Also see whether Psyco helps.

Python can be slow, but if you leverage the built in functionality
correctly you'll find it isn't much slower than C/C++ for many tasks, and
can even be faster than you would get from C/C++ without a spending a very
long time optimising it (that's because people have already spent a very
long time optimising Python's builtin functionality).

Even if you do eventually find you have to rewrite parts of the code in
C/C++ you should first have done what you can to optimise it in Python.
Usually the best way to speed up something which is too slow is to use a
different algorithm. That sort of change is comparatively easy to do in
Python but an expensive programming exercise in C/C++. When you come to
reimplement it then you'll be converting the already optimised code, which
in many cases will be much easier than writing it in C/C++ from scratch.

If you look at http://page.mi.fu-berlin.de/~prechel.../jccpprtTR.pdf
you'll see that, at least for that task, the relative runtimes for C/C++
and Python widely overlap. Yes, the C/C++ implementation included some very
fast ones, but they also included slows ones (and only Python of all the
languages tested had no unusable implementations ). OTOH, time to write the
programs does not overlap. Of course, since that paper was written Python
has changed a lot.
Mar 11 '07 #7
En Sun, 11 Mar 2007 06:34:03 -0300, Mike Schinkel <mi**********@g mail.com>
escribió:
I'm trying to write an app that parses a text file containing an outline
useing essentially the same indentation rules as Python source code, i.e.
the first level has no indent, the second level has one indent, third
You can get some ideas from tabnanny.py or reindent.py, but perhaps they
are too specific at parsing Python code.

I hope this informal description may help:

Start with IC = Previous IC = 0, and a stack with a single 0 element
For each line in the file:
compute the indentation column IC (that is, count the number of leading
whitespace characters; perhaps replacing tabs as 8 spaces)
compare IC with the Previous IC:
same: continue with next line
IC previous ("indent"): push IC onto indent stack
IC < previous ("dedent"):
discard top of stack
look at the new top of stack (but dont discard it); if not the same,
indentation error.
Previous IC = IC

Note: You can rewrite the above without using Previous IC, only the
stack... left to the reader :)
Note 2: At each stage, the "indentatio n level" is the current stack size.

--
Gabriel Genellina

Mar 11 '07 #8
"David Cramer" <dc...er@gmail. comwrote:
If you had an application that you were about to begin development on
which you wanted to be cross platform (at least Mac and Windows),
would you suggest using c++ and Python?

I'm asking because we were originally thinking about doing c# but
after attending PyCon this year I'm reconsidering. We are already
using Python for the website and I figure a c++ backend w/ a Python
GUI may work really well, and would be pretty easy to port.

Any opinions?
Why drag in the C++ ?
What do you intend to do in it that you can't do in python?
Seems unnecessarily complex to me.
And on a desktop, speed issues are kind of irrelevant - Python
is snappy enough on modern hardware for most things.

My style would be to have the gui connect via pipes to the
local backend as a separate process, with a third process if there
are any communications needed to off box dbs. But that is just
the way I think - YMMV

- Hendrik

Mar 11 '07 #9
ce
On Mar 11, 12:26 pm, "David Cramer" <dcra...@gmail. comwrote:
On Mar 10, 10:52 pm, "sjdevn...@yaho o.com" <sjdevn...@yaho o.com>
wrote:
David Cramer wrote:
If you had an application that you were about to begin development on
which you wanted to be cross platform (at least Mac and Windows),
would you suggest using c++ and Python?
I'd strongly consider a pure python solution (I'd choose wxpython),
but if I needed to code backend stuff in a lower level language I'd
use C rather than C++.

Well we want it to be very robust, and python isn't exactly the
fastest language, or one with the lowest overhead :)
only one word caught my attention "robust".. do u mean python is not
robust???
if this is your feeling, i don't recommend u to "reconsider " anymore,
turn back to ur previous programming language (what did'ya say it
was??? c# .. i remember one ad. about it's robustness .. a piece of
jelly!)

and by the way if u know something about C++, code the GUI with QT
(which would make it portable), and enjoy a high speed execution :P

Mar 11 '07 #10

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

Similar topics

38
4818
by: BORT | last post by:
Please forgive me if this is TOO newbie-ish. I am toying with the idea of teaching my ten year old a little about programming. I started my search with something like "best FREE programming language for kids." After MUCH clicking and high-level scanning, I am looking at Python and Forth. Both have advocates that say each is a great approach to learning computers. My programming classes were a long, long time ago in a land far, far...
217
9254
by: gyromagnetic | last post by:
The following url points to an article written by Damian Conway entitled "Ten Essential Development Practices": http://www.perl.com/pub/a/2005/07/14/bestpractices.html Althought the article has Perl as a focus, I thought that some of the general points made might be of interest to the Python community. It would certainly be interesting to put together an analogous version of this article that centers on Python. Best Regards,
12
1992
by: jeremyvoros | last post by:
So, I've written my first GUI app in python. I've turned it into a binary .exe and .app that runs on Windows and Mac respectively, but on my Linux box, where I wrote the thing, I still have to drop to the command line and ./myscript.py. What can I do to make it a "click and run" sort of application in KDE or Gnome on Linux?
3
3689
by: Martin Evans | last post by:
I've just been tasked with porting our desktop embedded Python support onto our existing CE offering. I've managed to compile the Python sources and have produced an armdbg420\python23.lib file. When I come to link to the Python library though from our one of our DLLs, I am getting the following unresolved externals: ------------------- embedded.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) int __cdecl...
8
4224
by: Dave Potts | last post by:
Hi, I'm just starting a development project in Python having spent time in the Java world. I was wondering what tool advice you could give me about setting up a continuous integration environment for the python code: get the latest source, run all the tests, package up, produce the docs, tag the code repository. I'm used to things like Maven and CruiseControl in the Java world. Cheers,
7
3584
by: sam | last post by:
dear all, having spent the last couple of weeks getting to grips with python on windows, i am in the position of trying to make the transition to my newly arrived ultra 20. however, although there are plenty of files with idle somewhere in the title, idle.py (which i assume is the interpreter) will not open, as there is 'no installed viewer.' surely sun have not installed python only for it to unusable? i may well be completely off...
113
5321
by: John Nagle | last post by:
The major complaint I have about Python is that the packages which connect it to other software components all seem to have serious problems. As long as you don't need to talk to anything outside the Python world, you're fine. But once you do, things go downhill. MySQLdb has version and platform compatibility problems. So does M2Crypto. The built-in SSL support is weak. Even basic sockets don't quite work right; the socket module...
37
9063
by: Michael Palmer | last post by:
As anyone knows, the state of Python GUI programming is a little fractured at this time, with many toolkits, wrappers and meta-wrappers dead and alive, with or without documentation. I've come across two projects that have the appeal of striving for simple, pythonic APIs: PyGUI and wax. The latter is a wrapper around wxPython. It is lacking documentation but actually quite usable and concise. The other, PyGUI, has an even nicer API and...
0
19320
by: Python Nutter | last post by:
Mini install guide for python on the iPhone: Cydia =Install SSH helps make initial configuration easier until you get used to MobileTerminal Cydia =Install MobileTerminal (closest to a bash shell you get on your iPhone currently) Cydia =Install Finder (graphical alternative to using SSH/MobileTerminal for setting permissions, navigating file system, moving/copying files, etc.) Cydia =Install Python (currently installs CPython 2.5.1)
0
9703
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
9564
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
9125
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
7604
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
6842
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
5500
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
5629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4275
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
3
2970
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.