It looks like PyObjC is not ported to Python 3 yet.
Meanwhile is there a way to write Cocoa applications using Python 3?
I am intending to start a new MacOSX GUI application project and though5 would want to use Python 3.x instead of Python 2.x.
For full-blown Cocoa, I think PyObjC is pretty much the only game in town. If you are coming to Cocoa from a Python background rather than to Python from an Obj-C Cocoa background, surely the learning curve of the Cocoa APIs is much steeper than the differences between Python 2.x and Python 3.x. So I think, at the moment, the best strategy is writing your app in Python 2.x while trying to make it as Python 3.x friendly as possible, including periodically running 2to3 on it as a check. And I'm sure patches for PyObjC to help with Python 3 support would be very welcome. If you are just looking for simple GUI interfaces rather than a full-blown Cocoa app, you might be able to get by with calls out to other packages like CocoaDialog or a Python 2.x-PyObjC dialog app :=)
Related
I am interested in developing a GUI application for OSX but would like, if possible, to avoid learning Obj. C or swift. I have the backend of the program written in python. Is there a good way of using xcode (and particularly the interface builder) to link up the GUI to the python backend?
P.s. I have come across PyObjC but the documentation sucks so I'm trying to avoid it.
Cheers,
Jack
Given your background and your motivations I would use PyQt with Qt Creator which contains a nice interface builder :
I"ve just barely started using kivy and followed the kivy basics tutorial and noticed that the latest download of the kivy library was named "Kivy-1.9.0-py2.7-win32-x86" implying that it is optimized for developing with (or just written in) py2.7 and NOT py3.o+. My question is can kivy be trustingly used for an app written in py3? My app specifically needs py3 changes concerning the unicode overhaul that happened with the new release. Will I run into any compatibility issues? If so, is there another library out there that will ease app development while using a newer distribution of Python? Thanks.
First, I don't know where you were looking, but on the official download page, there are Windows binaries for both Python 2.7 and 3.4.
Also, from the Kivy FAQ:
Does Kivy support Python 3.x?
Yes! As of version 1.8.0 Kivy supports both Python >= 2.7 and Python >= 3.3 with the same codebase.
However, be aware that while Kivy will run in Python 3.3+, packaging support is not yet complete. If you plan to create mobile apps for Android or iOS, you should use Python 2.7 for now.
3.x support is still relatively newish, but the fact that they're distribution official releases for 3.4 implies that you shouldn't have many compatibility issues, except for the one they mention above.
Of course if you're planning to use any third-party modules that aren't part of Kivy, you will want to check them all for 3.x compatibility too.
As a side note, on this:
If so, is there another library out there that will ease app development while using a newer distribution of Python?
Kivy is a pretty unique framework that would be hard to just replace with a different library without pretty much rethinking your whole app. Without knowing exactly why you chose Kivy and what exactly you were hoping to get out of it, it would be hard for anyone else to tell you what to try. (And, even with that information, it probably wouldn't be an appropriate question for StackOverflow.)
I am just starting to learn about integrating Python and Mac OS apps. (I want to call some methods from Cocoa to Python.) I've ran into these terminologies -- Scripting Bridge, PyObjC, and py2app. What's the difference? Is PyObjC an example of a scripting bridge? And when does py2app come into play?
The short version: PyObjC is the way you call Mac OS X APIs, Scripting Bridge is the way you talk to other apps' scripting interfaces. In more detail:
PyObjC is a bridge between the Python language and the Objective C runtime (and the set of Cocoa wrappers built trivially on top of that bridge, and some nice convenience stuff). If you want to call Cocoa methods, you use PyObjC, typically by importing either Cocoa or Foundation.
Scripting Bridge is a bridge between the Python language and the Apple Event-based scripting system. If you want to call another app's scripting interface, you use Scripting Bridge. (In most cases, if you're using Scripting Bridge, you'll also want to import Foundation, because Scripting Bridge deals with things like NSArrays, etc.)
So, PyObjC is not an example of a scripting bridge. An example of a scripting bridge is, well, Scripting Bridge, or Appscript (which is better, but not from Apple, and no longer maintained).
py2app has nothing much to do with either of these; it's a way to wrap up a Python application, together with all of the extension modules it requires, and as much of the Python interpreter as necessary, into a single .app bundle that you can distribute to users so they can just double-click to run it. Of course most such apps will have GUIs, and many of them will use PyObjC to create those GUIs directly in Cocoa (rather than using, e.g., PyQt or wxPython), but beyond that, there's no real connection.
What would be the optimal way to develop a basic graphical application for Windows based on a Python console script? It would be great if the solution could be distributed as a standalone directory, containing the .exe file.
As far as I understand your question, you want to write a graphical windows application in Python, to do this I suggest using wxPython and then py2exe to create a standalone exe that can run on any machine without requiring python to be installed
The following tutorial shows everything step by step: Quickly Creating Professional
Looking Application Using wxPython, py2exe and InnoSetup
I would recommend that you use IronPython, which is Microsoft's implementation of Python for the .NET framework.
Tkinter is quick and easy to use. Tkinter is in the Python standard library.
I am currently building a GUI based Python application on my mac and was wondering could anyone suggest a good GUI library to use?
I was looking at python's gui programming faq and there was a lot of options making it hard to choose.
I am developing on snow leopard and cross-platform is not essential (if it makes a difference).
If you're not concerned about cross-platform compatibility, then PyObjC (also see Apple's info about PyObjC) provides a direct bridge to the native OS X Cocoa interfaces.
PyObjC (pronounced pie-obz-see) is the key piece which makes it possible to write Cocoa applications in Python. It enables Python objects to message Objective-C objects as if they're fellow Python objects, and likewise facilitates Objective-C objects to message Python objects as brethren.
Note that Apple tends to support and then not support these non-native interfaces to Cocoa; it's a good sign that there are recent releases of PyObjC.
wxPython and Qt (via PyQT or PySide) provide native OS X widgets and work across all major platforms.
There's a relatively new project active now called PyGUI which aims to provide a more modern cross-platform GUI for Python apps. On OS X, it uses PyObjC to provide native GUI elements. It might be easier to get started using it rather than delving directly into PyObjC and Interface Builder.