background preloader

Python Mac OS X

Facebook Twitter

TextMate — The Missing Editor for Mac OS X. Very Simple OS X Cocoa Application using Python and Interface Builder | Adam Wisniewski's Blog. The Very Simple App I’ve been playing around with creating a small Cocoa App for the last week or so. Finding good examples and documentation has been a little problematic, so I’ve put together a tiny application as a reference point to get going when starting fresh. It’s built entirely in Python using Cocoa through the PyObjC wrappers. It includes a XIB created with Interface Builder in Xcode. Bundling the App for distribution is a snap using the py2app command in setuptools.

Source on GitHub: simple_pyobjc_cocoa_xib All the required Python: The most useful resource for me has been the source available in the PyObjC examples. The py2app tutorial has been useful for getting the initial project set up. Below are the steps I took to create the application with a 5 minute video of the process at the bottom. Create setup.py The tool used to create a setup.py file is py2applet. . $ /System/Library/Frameworks/Python.framework/Versions/Current/Extras/bin/py2applet --make-setup SimpleXibDemo.py. PyQt : la rencontre entre Python et Qt | Pierre Gradot.

L’existence d’un binding pour utiliser Qt depuis Python faisait partie de ma liste des bonnes raisons d’apprendre Python. J’avais déjà utilisé Qt en version originale, c’est-à-dire en C++, pour faire des interfaces graphiques ou gérer une base de données. Vous pouvez voir le code sur ma page Github les projets UnMineMe et DiskDB. La possibilité de faire mes interfaces graphiques en Python grâce à Qt et réutiliser mes connaissances de ce framework était donc un point positif.

PyQt ou PySide ? Il existe en fait deux bindings de Qt vers Python. Installation Commençons par installer PyQt en nous rendant à la page de téléchargement de PyQt4, la dernière version du framework. La compilation pour SIP et pour PyQt se fait de la même façon : Un sudo sera sûrement nécessaire pour la dernière commande. Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information.

>>> import PyQt4 >>> Premier programme. Distributing your program on Mac OS X. Creating self-contained applications on Mac OS X is not quite as straight-forward as it is on Windows but as long as you follow the guidance below all will be okay. Python and PyQt Unfortunately the current version of cx_Freeze on Mac OS X does not play particularly nicely with Python versions that have been installed from Python.org or PyQt if you have installed it previously using our instructions.

Therefore, to ensure that cx_Freeze installs successfully you will need to install Python and PyQt using a package manager called MacPorts. Thankfully, the MacPorts installation of Python and PyQt is separate from your existing installation so you do not need to remove any files before you start. MacPorts MacPorts is a package manager for Mac OS X which is designed to make working with tools that are predominately Unix based much easier. Installing MacPorts To install MacPorts you will need to do the following: Using MacPorts to install Python and PyQt Adding a missing library Installing cx_Freeze.

The MacPorts Project -- Home.