100 % portable ?

  • Thread starter Vent d'Est - East Wind
  • Start date
V

Vent d'Est - East Wind

i have some question about portability of python

for my part i work under the 3 systemes (windows , linux , mac os x
sometimes mac os classic too )

i want to know how i can be sure at 100 % that my programme is portable
(i dont want code each times i use other system )

i suppose for GUI is same

wich thing need i pay attention (language , system , library .. )
do you have some graphic library to propose (i see GTK , Tkinter and
WXwindow )

thankx in advance for you reply

East wind
 
J

Jeff Epler

How can you be sure? I recommend you do it by writing a test-suite for
your software and running it on all the platforms you wish to target.

On the other hand, Python has had "pretty good" portability for me in
the past, at least where Windows, Linux, and Unix are concerned.

Jeff

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFBKJ7rJd01MZaTXX0RAgo9AJ9oRbnBELKKQSlgdChWPx3HiGUiOwCbBSpW
FfLI3BXczpX1nB+WVoml6/4=
=wMfB
-----END PGP SIGNATURE-----
 
R

Roger Binns

Vent said:
i want to know how i can be sure at 100 % that my programme is portable
(i dont want code each times i use other system )

You will have to run your program on all platforms. The Python
library documentation pages tell you which platform the modules
are on. The vast majority are on all.

Note that for some things you would want different code. For
example the default location to save files may be My Documents
on Windows and $HOME on Linux and Mac. Similarly you would
want to save configuration settings in the registry on Windows
and dot files on Linux and Mac.
i suppose for GUI is same

My preferred toolkit is the wxPython wrapper around wxWidgets.
Wherever possible it uses native widgets. It also has functionality
often lacked by other toolkits such as printing, keyboard,
configuration (backend to registry, files etc).

Just to give you some idea, in my 30,000 line program there are
5 tests to see what platform it is running on, specifically to
ensure appropriate defaults etc for the platform.

For the gui, there are two programs you can try that use wxPython.

http://dotamatic.sf.net
http://bitpim.org

Both are open source so you can see for yourself. Both use the
clipboard, do printing, have online help, are distributed so
that the user doesn't need Python on their machine already etc.

Roger
 
D

David M. Cooke

Roger Binns said:
Note that for some things you would want different code. For
example the default location to save files may be My Documents
on Windows and $HOME on Linux and Mac. Similarly you would
want to save configuration settings in the registry on Windows
and dot files on Linux and Mac.

For Mac the preferred place files is ~/Documents, and for config files
is in ~/Library/<application name>/.
 
S

Sion Arrowsmith

Roger Binns said:
My preferred toolkit is the wxPython wrapper around wxWidgets.
Wherever possible it uses native widgets. [ ... ]

Just to give you some idea, in my 30,000 line program there are
5 tests to see what platform it is running on, specifically to
ensure appropriate defaults etc for the platform.

Sounds about right to me -- I've got about 20,000 lines of
application with six platform tests, five of which are to
work around platform-specific infelicities in wx.
 
J

Jorge Godoy

Sion Arrowsmith said:
Roger Binns said:
My preferred toolkit is the wxPython wrapper around wxWidgets.
Wherever possible it uses native widgets. [ ... ]

Just to give you some idea, in my 30,000 line program there are
5 tests to see what platform it is running on, specifically to
ensure appropriate defaults etc for the platform.

Sounds about right to me -- I've got about 20,000 lines of
application with six platform tests, five of which are to
work around platform-specific infelicities in wx.

This sounds very interesting.

Do any of you have those tests and workarounds publicly available?
 
V

Vent d'Est - East Wind

http://dotamatic.sf.net
http://bitpim.org

Both are open source so you can see for yourself. Both use the
clipboard, do printing, have online help, are distributed so
that the user doesn't need Python on their machine already etc.

Roger

i see your website , but i see for mac os x you using cocoa interfacing
i don't understand isnt WXpython from WXwindow and have in all system
same apparence ?

same for linux i see a like kde 2 interfacing using

seems each you use each interface of each system
(and not just one for every system)

is that only using wxpython or add some other graphic toolkit port and
using cocoa , kde interface ?

thankx for reply
 
D

Dave Cook

You can use os.environ["HOME"], this will return the user's home dir.

Doesn't work in win9x AFAIK. I do notice that some people are starting to
require XP for their apps.

Dave Cook
 
M

Mike C. Fletcher

Tim said:
[Bernd Kaiser]

You can use os.environ["HOME"], this will return the user's home dir.
See this old thread:
http://groups.google.ca/groups?threadm=mailman.1140.1075749926.12720.python-list@python.org

The OpenGLContext code should work for Win98, 2K, and XP, maybe for
Win95 and NT too, but I don't have them for testing.

Enjoy,
Mike

________________________________________________
Mike C. Fletcher
Designer, VR Plumber, Coder
http://www.vrplumber.com
http://blog.vrplumber.com
 
D

David M. Cooke

At some point said:
i see your website , but i see for mac os x you using cocoa interfacing
i don't understand isnt WXpython from WXwindow and have in all system
same apparence ?

same for linux i see a like kde 2 interfacing using

seems each you use each interface of each system
(and not just one for every system)

is that only using wxpython or add some other graphic toolkit port and
using cocoa , kde interface ?

I think you've missed the point of wxWidgets/wxPython: it uses native
widgets on each platform. On OS X, it uses Aqua widgets; on Linux, QT
or GTK, on Windows, native Windows widgets.

So, you're not going to get the same appearence on different
platforms (which is a good thing; I don't want to use something that
looks like Windows on a Mac).
 
S

Sion Arrowsmith

This sounds very interesting.

Do any of you have those tests and workarounds publicly available?

The tests are just a matter of checking sys.platform at the
appropriate point -- since the target platforms ATM are only
Windows and Linux a simple == "win32" or != "win32" depending
on which requires special treatment (usually Linux/GTK) does
the job.

I really should stick at least some of this stuff on the wiki
(http://wiki.wxpython.org/index.cgi/wxPython_20Platform_20Inconsistencies)
-- for that matter, I should refine and bug-report the ones I
haven't already.
 
V

Vent d'Est - East Wind

I think you've missed the point of wxWidgets/wxPython: it uses native
widgets on each platform. On OS X, it uses Aqua widgets; on Linux, QT
or GTK, on Windows, native Windows widgets.

So, you're not going to get the same appearence on different
platforms (which is a good thing; I don't want to use something that
looks like Windows on a Mac).

yeah i like it too Acqua style , but what i didn't understand before
it s how it can be do that (my point of view was like a java vm , so
that s why i think it s same apparence in other system too)
now i visited wxwidget , explanation simple and interresting :)
just what i search , graphical toolkit native on different plateforme
supporting same code :)

thankxx a lot
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top