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.
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 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.
I'm trying to find a good "python GUI framework" for Mac OS X, but I haven't found anything good until now, only wxWidgets which I don't like and it's also unstable.
Any suggestions?
I use pyqt (pyside should be equivalent but with more relaxed license terms) and I find it pleasing and useful -- I also like the fact that (with no extra effort on my part) it gives me cross-platform apps!-)
pyobjc (comes w/your Mac, works w/Xcode, etc) may be preferable for apps you never want to be cross-platform, but I find it less easily usable than PyQt. However if you're very skilled in Objective C, Cocoa etc, I imagine pyobjc will feel perfectly natural and usable to you!-).
For the most MacOSX you could use PyObjc which basically allows you to write Cocoa apps i python using Interface Builder etc.
Quick question.
I'm using Linux and I want to try making a GUI with Python. I've heard about something like Qt, GTK+ and PyGTK but I don't know what they are exactly and what the difference between them is.
Is there any difference on how they work with different DEs like GNOME, KDE, XFCE etc.? Is there any IDE that allows you to create GUI like Microsoft Visual Studio does (for C#, C, Visual Basic etc.)?
Or should I maybe use another language other than Python to make GUI applications?
Your first step should be http://wiki.python.org/moin/GuiProgramming
Some tool-kits integrate better in one environment over the other. For example PyQt, PyKDE (and the brand new PySide) will play nicer in a KDE environment, while the GTK versions (including the WX-widgets) will blend better into a GNOME/XFCE desktops.
You should look at the environment you want to target. You can go for basic portable GUI kit, or you can to a deeper integration with tour DE, like use of integrated password manager, and configuration file parsers, that are integrated in a specific DE like KDE or GNOME.
You should also consider the dependency that your selection dictates, and what is come by default with a basic DE. For example, PyKDE in the KDE 3.X branch had a non trivial set of dependencies, while at the 4.X branch the plasma binding made the Python GUI programming dependency less of an issue.
There are several IDE tools, in different levels of completeness and maturity. The best thing is to try one ore more, and see what best fit your needs.
I would avoid using another language to make a GUI for Python.
I've had every good luck with wxwidgets, which is the python binding for WX, a cross-platform development system. It's pretty easy to learn and quite powerful. The problem with wxwidgets is that it is not installed by default, so your users will need to install it on every platform that they wish to run your application. Find more information about it at http://wxwidgets.org/.
If you want people to be able to use your program without installing anything else, use Tkinter, the GUI system that comes with Python.
I would avoid the Python bindings for GTK or KDE unless you already know those systems. They also need to be downloaded, and they do not seem to have as much adoption as wxwidgets.
Each desktop environment uses a specific toolkit to build it's components. For example, KDE uses Qt and GNOME uses Gtk.
Your use of a toolkit will be dependent upon what type of desktop environment you're targeting at, and if you want to target a wide range of desktops then use a toolkit which will work on many desktop environments, like Wx widgets which will work on Linux, Mac OS and Windows. For building simple GUI applications, Tkinter will do.
Use the glade UI designer and pyGtk bindings... that was my first ever experience with python and there are lots of blog posts and tutorials to help you get started
Use PyGTK. As important as the toolkit is its underpinnings, with PyGTK you use GLib as well, with its filesystem abstractions (python module gio) that are very important for the Linux desktop, its high-level cross-desktop functions such as glib.get_user_data_dir() and its other application framework tools, and GObject and its property and signals model.
In .Net you have companies like DevEpxress, and Infragistics that offer a range of GUI widgets. Is there any market like that for Python GUI widgets? I'm thinking specifically about widgets like the DevExpress xtraGrid Suite.
Edit 01-16-09: For Example:
http://www.devexpress.com/Downloads/NET/OnlineDemos.xml
http://demos.devexpress.com/ASPxGridViewDemos/
http://www.infragistics.com/products/default.aspx
There are a number of GUI Toolkits available for Python. Obviously, the toolkit you choose will determine your selection of 3rd party widgets.
The Contenders
Python comes with Tkinter which is easy to use, but not great looking.
There are some very popular cross platform GUI toolkits borrowed from C/C++ that have a lot of external widgets: wxPython, pyQt, pyFLTK, pyGtk
I also know of, but have not used some of the other toolkits that are out there: PyGUI, Easygui, PythonCard
My Choice
I'm a fan of wxPython. They have a nice selection of widgets, some great examples that come with the install, good documentation, a book, and an active community.
WxWidgets has additional components offered by the community called wxCode.
Quote about wxPython from the creator of Python:
wxPython is the best and most mature cross-platform GUI toolkit,
given a number of constraints. The only reason wxPython isn't the
standard Python GUI toolkit is that Tkinter was there first.
-- Guido van Rossum
The popular Python GUI toolkits are usually wrappers around external (usually C, C++) libraries. So whatever 3rd party products those external libraries have, Python code can benefit (by minimal manual wrapping even in case the 3rd party solution does not provide Python wrappers by default).
wxPython is a wrapper around wxWidgets, LGPL (approximately) and very comprehensive
pyQT is a similair wrapper around QT, it's available as GPL or commercial
Although QT is now under the LGPL pyQT is a separate commercial product, it may be that they now release it under the LGPL or a community effort might now produce a LGPL alternative.
Both run on MS/Linux/Mac and are pretty comprehensive, there are excellent communities and books for both.
All Python GUI tools has nowhere close or comparable to C#.Net GUI like DevExpress, Infragistic, Telerik, ComponentOne. The quality of those GUI will never be able match the capabilities offered by .Net GUI. C# programming has superior set of WSIWYG programming tools to build multiplatform app like Visual Studio(for windows/mac), Unity3D (for games), Blend(for web), Xamarin(mobile app). However on the downside it doesn't have as much as Python package or library for computation. So to bridge the gap usually I'll build interface completely on C#.Net and if it requires extensive calculation i'll call Python script by using IronPython for .Net.
Heaps of GUI apis are available. PyQT, PtGTK, Tkinter...
-T
There's also wxPython, which is a wrapper around wxWidgets which is quite popular, works on many platforms and liberally licensed.
QT would probably be the other one I would look at, especially now that the next release will be licensed under the LGPL.
I don't see any commercial packages for GUI in Python but as I know Kivy is a good option for creating fast and beautiful GUI
https://github.com/kivy/kivy