3

Can you make a universal python application that will run on both OSX and Windows? With the same menu system, etc? Or would you need to make different versions for each OS?

asked Aug 4, 2011 at 14:50
3

5 Answers 5

6

I have built several cross platform applications (Windows / OS X) with wxPython. Practically all of the code translates flawlessly across the two platforms. To put into context, I usually develop the applications on Mac OS side, and if I spend let's say one week hammering out an application, I spend something like a few hours to get it running nicely in Windows.

Usually those hours consist of:

  • Tweaking minor wxPython visuals (font sizes, colors)
  • Making nice things like embedded icons
  • Keyboard shortcuts (CMD vs CTRL)
  • Main menu

Like you correctly point out, if you want identical main menus you have some work ahead of you on OS X side. I myself have never really bothered, I am fine with having some additional OS X default main menu bits and pieces.

The main menu thing aside though, considering how little tweaking you have to do, I'd say wxPython is the way to go. Together with px2exe on Windows side and py2app on OS X side it packs quite the punch.

answered Aug 15, 2011 at 7:18
Sign up to request clarification or add additional context in comments.

Comments

3

Yes. You could build it with Qt for its interface and then you'll have to make judicious use of the os library to make sure that everything plays nicely no matter what operating system it's running on. However when it comes to packaging it for distribution, you'll have to do them separately. For Windows you can use py2exe, which will build a binary package which bundles in the Python runtime and all the libraries you use. I'm not sure how it works in Mac though.

answered Aug 4, 2011 at 15:03

Comments

0

You can try some of cross-platform tools e.g. Appcelerator Titanium Desktop supports python based development.

answered Aug 4, 2011 at 15:06

Comments

0

I'm currently developing an app on my Ubuntu Linux machine. I real life it runs on a windows xp machine with touchpad.

I'm using wxPython as the gui toolkit. In the past I've used .net predominantly but I wanted cross platform.

It really runs without any checks about which os it is running on. (save one check where i read a textfile and i have some trouble with the line endings)

answered Oct 26, 2011 at 12:11

Comments

0

To add on to what has already been given ...

If you rely on any os.system calls, you could also run into places where your code needs to handle the different platforms, well, differently.

As an example, I have an application which has a Help menu option which opens up a pdf file. My code would be like:

if arch.find("indows"):
 os.system("start " + help_filename)
elif arch.find("inux"):
 os.system("xdg-open " + help_filename)
else: # really this is the Mac case
 os.system("open " + help_filename)
answered Dec 19, 2012 at 15:05

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.