PC -> Mac OS-X cross-development

Posted by gtippery on 2007-04-03 22:34

I'm trying to port some educational programs from PC-DOS and Windows to Mac OS-X for use by the local public schools. They're written in various dialects of Pascal and BASIC, but there are no compatable versions for Macs. Among portable languages, Python seems to be one of the better free choices, and I've chosen ActivePython for the PC/development end. Unfortunately, I don't have easy access to a Mac with OS-X (or anything past OS8, actually.)

What features can I assume will be supported by default under OS-X? In console/text/tty mode, will I be able to set character attributes, like color or bold? How about cursor addressing and screen clearing? Will I be able to generate any sounds?

And in GUI mode, what widgets are available in OS-X, and are they also in the default ActivePython installation? Do I need to learn Tk and/or Tcl?

Also, what's the simplest way to move the Python code to the Macs? I can burn CDs but I don't know what Macs require in the way of CD formats. I can also just post the code to a web page. I'd like to make using the programs as easy and nonintrusive as possible, preferably not requiring any customization on the Macs.


shanec | Wed, 2007-04-04 09:57

If you're rewriting from scratch in a different language, you might consider writing in javascript/html (or better yet, XUL or Flex) so you don't have to worry about platform GUI issues.

OSX comes with Python installed, but not with any worthwhile GUI interface. If you rewrite in Python, you should look at wxPython for your GUI layer (not a part of ActivePython). OSX runs Bash as the default shell, so anything you do on linux should work fine on OSX with little if any modifications.

gtippery | Thu, 2007-04-05 01:04

I did consider Javascript/ECMAScript, but am having trouble finding "how-to" info for non-web uses of JS; in particular, file I/O and nonechoing keyboard input. What I have found appears to be nonportable. I may still use JS+HTML for one app that doesn't need file I/O, and can get by with pregenerated GIFs and WAVs instead of generating sound and graphics on the fly as the original does. I'm also considering HTML-TADS for that particular app, as I've used it before.

I strongly considered Java, and it's still on my "possible" list, but I just don't like Java {grin}. The runtime's huge, too.

XUL, Flex, etc. would require the schools to install runtimes on their computers, right? They're reluctant to do that for various reasons. Python apparently is installed by default. Sorry to here there isn't good GUI support. I don't know if wxPython would have to be installed separately or could be merged into the app somehow.

I can reboot from W98 (laptop) or XP (desk machine) into Linux (Knoppix or Mepis currently) but can't run the original apps or compilers while in Linux. Not a major problem, but a nuisance. I also would prefer to avoid learning Linux and Python at the same time, if practical. As far as Bash making things compatable, wouldn't that only apply to scripts, and not apps, especially GUI apps?

Thanks much for your comments and suggestions. Any others are welcome.

shanec | Thu, 2007-04-05 07:14

On both OSX (x86) and Linux (x86) you can use emulation software to run dos and some windows applications (search google for Wine or dosemu). That might be a more immediate solution, though I would still suggest a rewrite to a higher level language (like Python). Regardless of what you pick, something is going to have to be installed on some machines. It is possible that wxPython is installed on your Linux distro already, but it certainly will not be on your Windows Python distribution.

gscarr | Sat, 2007-08-25 14:43

Tkinter is part of the standard python distribution. Both the one already built into OS X and the ActiveState one for OS X. shanec may not consider it a "worthwhile GUI interface" but it's your simplest approach for python.

The most mac-like way to distribute programs is to create a dmg (disk image) file but that requires a Mac AFAIK. A zip file will also work but requires extra instructions. wxPython does not appear to work with ActiveState's python so you would have have people do 3 installs (python, wxPyhton and your program). But if you create a dmg you can bundle it all into a "package" file that looks like an application file on macs. I'm sure you could get somebody from the mac python community to help you out with that step.