Python GUI Library for Windows/Gnome - python

I need to create a desktop app that will work with Windows and Gnome(Ubuntu). I would like to use Python to do this. The GUI part of the app will be a single form with a message area and a couple of buttons.
The list of GUI's for Python seems overwhelming. I am looking for something simple if possible, the main requirements is it must work with Gnome(2.26 and up) and Windows XP/Vista/7.

You might want to check out wxPython. It's a mature project and should work on Windows
and Linux (Gnome).

PyGTK is a very popular GUI toolkit, but usually quite a bit easier to use on Linux than on Windows.

Have you checked the extensive list of GUI libs for Python? For something simple I recommend, as does the list, EasyGUI.

You can also try PyQt or PySide. Both are Python wrappers to Qt. PyQt is the original wrapper; PySide is a new project by Qt Development Frameworks/Nokia that has pretty much the same aims as PyQt, just with different licensing. PyQt is more mature, but licensing is more restrictive; PySide is quite new (in alpha/beta) but with more liberal licensing. However, for real information on licensing, check their site and preferably with a lawyer if it concerns you.

Related

implement a database application with GUI for Windows, written with Linux

I have the following data scheme that I want to turn into an application. A regular desktop GUI would probably the best.
UML Diagram http://img217.imageshack.us/img217/341/56836587.jpg
big version
The whole thing would be developed on a Linux (Ubuntu, Gnome) machine, and then used on a Windows Vista computer. If Windows is a problem, I might be able to just run it in a Linux VM later.
My programming language of choice would be Python. I have only used Qt for a two hour project, I have pretty much no experience with GUI. Would Qt work easily on Windows and not look to out of place there? Is GTK a way better option, or is that merely preference issue?
From talking on the #python channel, I gathered that storing the data in a SQLite database would be a good option, and accessing this data via the SQLAlchemy ORM would be better than writing SQL statements by hand. The latter is my usual approach, I want to use this project to learn something better.
Can I just design the dialogues in Qt Designer and use them with my Python objects?
You might want to check out Dabo.
Dabo is a 3-tier, cross-platform application development framework, written in Python atop the wxPython GUI toolkit
Camelot
If you are set on using Python them I think Qt would be am excellent choice. It's a fantastic framework that looks good and runs on many platforms. You won't be limited to Windows. Qt can be a bit intimidating but you won't be limited in terms of functionality. The Qt designer works well with Python.
SQLAlchemy works on all common desktop platforms, including Windows.

Are there an GUI libraries for Python that allow you to compile to an EXE (windows) and APP(Mac)?

I'm working on an application that I need to be cross-platform. I'd like to use Python for it, and am looking for GUI toolkits that make interface programming simple and easy. After a slight hunt, I found PythonCard. This looks like it fits the bill perfectly, but I'm not sure if it will be possible to compile this down to an appropriate executable for each operating system. I found these instructions, but they're 6 years old.
Whatever solution I choose must support the following:
Write one GUI to work on both Windows and Mac OSX
Must 'compile' into an easily distributable file for both windows/mac
Compiled file must not require Python to be installed on the users computer
Can anyone recommend a library/solution before I have to wade into the desolate world of Java?
I think the answer here is less about the particular GUI toolkit and more about distributing stand-alone python applications. Personally, I've found the tools for this a little less perfect than I'd like but, after some finagling, they get the job done. The most likely candidate that'd fit your needs is cx_Freeze. Though there's a Windows specific py2exe and Mac specific py2app that might fill the bill if cx_Freeze is insufficient.
Use PyInstaller to distribute an app using PyQt or WxPython gui toolkits. From the website:
PyInstaller is a program that converts (packages) Python programs into stand-alone executables, under Windows, Linux, and Mac OS X.
As for gui toolkits, PyInstaller is documented to work with Qt3, Qt4, and WxPython.
StackOverflow contributor dF, uses PyInstaller "for an app which depends on PyQt, PyQwt, numpy, scipy and a few more."
Hmm.
Maybe it'd better to move my post to comments, but. Why do you want to 'compile' python code, and why do you think that some GUI framework should provide some packaging/installation facilities?
In our company we wrote cross-platform GUI app and of course we must make it easily deliverable for customers. So, we found suitable GUI framework with python bindings (Qt), then we chosen the method to hide unneeded details about realisation and vanish dependancies (Py2Exe for Windows, Py2App for Mac, and nothing for linux, but you can try PyInstaller or cx-freeze).
Installation for every OS made in that OS' way, according to the least astonishment principle. That's why we did not pack linux version in some kind of binary executables.
If you want your application to look and feel native, then wxPython is the way to go. PyQt can look native, but it doesn't sound like it always behaves in a native way (according to some threads I've read). To build binaries, use py2exe or some such for Windows and py2app for Mac
This presentation walks through the process and also winds up with Py2exe and Py2app...
For Wxpython GUI designers check this question. I breifly tried boa-contstructor but I found it too limiting -as not all widgets are supported. AFAIK none of the wxpython designers support all widgets (out of the box atleast).
I personally find it faster and easier to hand code my GUI's. Id say it only took me a few days to become reasonably comfortable/familar wxpython. If you need to do anything other then creating a simple application then taking a little bit of time to learn wxpython will pay its dividends.
If your bound to the idea of having a descent GUI designer then your best bet is probabaly PyQt as this IMHO is the only toolkit that has a solid mature editor -Qt Designer
As for creating standalone excutables Ive only used py2exe for windows. py2app does the same for mac although I have not tried that yet.
For windows installers checkout this thread

Creating GUI with Python in Linux

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.

What Python GUI APIs Are Out There? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
Simple question:
What Python GUI API's are out there and what are the advantages of any given API?
I'm not looking for a religious war here, I'm just wanting to get a good handle on all that is out there in terms of Python GUI APIs.
Here's a good list.
I've used Tkinter and wxPython. Tkinter is quite basic, and doesn't use native widgets. This means that Tkinter applications will look the same on any platform – this might sound appealing, but in practice, it means they look ugly on any platform :-/ Nevertheless, it's pretty easy to use. I found Thinking in Tkinter very helpful when I was learning, because I'd never done any GUI programming before. If things like frames and layout algorithms and buttons and bindings are familiar to you, though, you can skip that step.
You can augment Tkinter with Tix (but be warned, Tix doesn't play well with py2exe). Also check out Python Megawidgets, which builds some more advanced controls using the Tkinter basics.
Finally, Tkinter plays nice with the shell: you can start the interpreter, do things like 'import tkinter' 'tk = tkinter.Tk()' etc. and build your GUI interactively (and it will be responsive). (I think this doesn't work if you use IDLE, though)
wxPython is much better looking, and ships with a much greater range of controls. It's cross-platform (though it seems a bit finicky on my Mac) and uses native controls on each platform. It's a bit confusing, though. It also ships with a demo application that shows off most of its features, and provides a test-bed for you to experiment. Some specific thoughts on wxPython:
There are three (?) different ways to lay widgets out. Ignore two of them; just use Sizers. And even then, you can do just about any layout using only BoxSizer and GridBagSizer.
All wx widgets have IDs. You don't need to care what the IDs are, but in the old days (I think) you did need to know, so some old code will be littered with explicit ID assignments. And most demo code will have -1 everywhere as the ID parameter (despite the fact that the methods all have ID as a keyword parameter that defaults to -1 anyway).
Make sure you get the standard wxWidgets docs as well as the wxPython Demo – you need them both.
If you want to use wxPython with py2exe and you want it to look good on Windows XP, you need a bit of trickery in your setup.py. See here
PyQt is excellent if you have experience or interest in Qt.
http://www.riverbankcomputing.co.uk/software/pyqt/intro
Most python GUI APIs will be wrappers around the most common c/c++ GUI APIs. You've got a python wrapper for gtk, a python wrapper for qt, a python wrapper for .NET, etc etc.
So really it depends on what your needs are. If you are looking for the easiest way to draw native-looking widgets on Linux, Mac, and Windows, then go with wxPython (python wrapper for WX Widgets). If cross-platform isn't one of your needs though, other libraries might be more useful.
Instead of posting a list of your options I will give my humble opinion:
I am in love with wxPython.
I have used Qt in C++ and Tk way back in the Tcl days but what really makes me like wxPython is the demo that you get with it. In the demo you can browse through all the different widgets frames etc that are part of the framework see the source code and actually see how it looks while it is running.
I had some problems getting the Linux version build and installed but now that I have it available I use it all the time. I have used wxPython for small data analysis applications and I have written several internal tools related to comparing test results, merging source code etc.
I found this link a long time a go: http://www.awaretek.com/toolkits.html. It suggests a tookit based on your criteria. For me it suggests wxPython all the time. Anyway it gives you a bunch of scores on the various toolkits. What is right for me may not be right for you. But it gives you how all the tookits scored according to your criteria, so if you don't like the top toolkit for some reason you can see which ones are closest to your criteria.
QT/GTK/WxWidgets (formerly wxWindows) seem to be among the most mature cross platform GUI toolkits. The only issue is that none is installed with the default installation of Python, so you may have to compile the libraries. If you want something with no installation required that just runs, then go with TKInter because as has been mentioned it is installed by default with Python.
Anyway my criteria were 9 on Ease of Use, 10 on maturity of documentation/widgets, 10 on installed base, 5 on gui code generators, 10 on native look and feel for both windows/linux and 1 and 5 for the last two, I'm not big into Mac OSX (even with a 10 here it suggests wxpython).
PythonCard is really easy to use. That's what I would recommend.
Here's their writeup:
PythonCard is a GUI construction kit
for building cross-platform desktop
applications on Windows, Mac OS X, and
Linux, using the Python language.
The PythonCard motto is "Simple things
should be simple and complex things
should be possible."
PythonCard is for you if you want to
develop graphical applications quickly
and easily with a minimum of effort
and coding. Apple's HyperCard is one
of our inspirations; simple, yet
powerful.
PythonCard uses wxPython. If you are
already familiar with wxPython, just
think of PythonCard as a simpler way
of doing wxPython programs with a
whole lot of samples and tools already
in place for you to copy and subclass
and tools to help you build
cross-platform applications.
EasyGUI is different from other GUIs in that EasyGUI is NOT event-driven. It allows you to program in a traditional linear fashion, and to put up dialogs for simple input and output when you need to. If you have not yet learned the event-driven paradigm for GUI programming, EasyGUI will allow you to be productive with very basic tasks immediately. Later, if you wish to make the transition to an event-driven GUI paradigm, you can do so with a more powerful GUI package such as anygui, PythonCard, Tkinter, wxPython, etc.
EasyGui Website
WX has issues on the Mac.
I had a look here, as I want to get an event driven GUI API to do some stuff in Python. I have wx installed on my mac as part of MatPlotLib, but it does not work properly. It wont take in put from the keyboard. I have installed this three times on three different Mac operating systems, and though it worked the first time, the other two times I had this issue.
This version I am using with Enthought's distribution, so no installation was necessary. When I have installed it separately, there were so many dependent installations, that it was a trial to install.
From what I have read here, I will give Tkinter a go, as this needs to be simple and cross platform, but I thought I would just share the above with you. I like the Mac OS for a number of different reasons, but python tools install far easier on Windows (and probably other Linux). I just thought I would give a Mac perspective here.
I like wxPython or Tk.
Tk comes with the standard Python distribution so you don't need install anything else.
wxPython (wxWigets) seems much more powerful and looks a lot nicer. It also works well cross-platform (though not perfectly because it uses different underlying graphic API's on diff system types)
I prefer PyGTK, because I am a GNOME guy. Using PyGTK feels very pythonic to me. The code organization feels consistent, the documentation is clean and thorough, and it's a very easy toolkit to get used to (except for maybe Treeviews).
An easy to use GUI creator for Python doesn't exist. That's amazing really considering small scripting languages like AutoIt and AutoHotkey have great and very simple to use GUI makers. Come on, Python followers, can't you do better?
I've been working with wxPython for a few years now and I like it quite a bit. The best thing about wxPython is that the UI feels native on the different platforms it runs on (excellent on Windows and Linux though not as good on OS/X).
The API lacks some consistency, but you quickly get used to it.
You can check out Testuff (shameless plug, as it's my own product) to get a feeling of what can be done with wxPython (although I must say, with quite a bit of effort).
wxPython, and I'm assuming PyGTK also, can use wxGlade to help you design most UIs you will create. That is a big plus. You don't have to learn how to hand-code the GUI until you're ready. I made several GUI programs straight from wxGlade before I was comfortable enough in how wxPython worked to take a shot at hand-coding.
PyQt has a similar graphic layout device but I've never had good luck getting PyQt to compile correctly. There was also a lack of tutorials and documentation that showed how to create the final Python code; many of the documents I found referred to the C++ version of Qt.
Tkinter is good for quick and dirty programs but, realistically, if you use wxGlade it may be faster to make the program with wxPython. At a minimum, you can use wxGlade to show a visual representation of the program to a client rather than take the time to hand-code the "dummy" program.
There are python-specific gui-api such as kivy (successor or pymt), pygui (based on pyrex), pyui and nufox, which do not compare with the more robust toolkits like wxpython, pyqt, pygtk and tkinter.
They are just extra optional tools.
The only thing unique about them is these are python-specific api, just like there are prima (perl-specific api) and shoes (ruby-specific api). It helps us to understand that when tk is tcl-based port of api (and others are c and c++ based), then these api are specifically done for the respective three scripting languages.
Out of these, kivy is the most robust, whereas pygui's coding is mentioned to be very python-like, pyui is least robust but worth trying and all of these should be portable wherever python or python-based application goes.
Then there is jpype which is a toolkit usable with jython and pydev, and which is actually java's japi customized under python/jython-interface.

Python desktop widgets

I'm interested in making desktop widgets, similar to Apple's Dashboard or what Vista has. I'd like to make them cross-platform, if possible. Opera's widgets are cross-platform but require the user to have Opera installed, so that's a big limitation.
I know most widgets are made with HTML/XML, CSS, and Javascript. Is there a way to create them using Python?
Update: I did find a site talking about Pyjamas. Does anyone have experience with it and, if so, what are its capabilities/limitations?
You should take a look at what the guys at Digsby are doing. Basically, they've written a port of WebKit to wxWidgets, and then use WebKit to render the interface, and wxPython for writing the rest of the app. Pretty neat, but very alpha at the moment.
Take a look at gDesklets. AFAIK they're UNIX only, but mabybe porting them to other platforms make more sense than starting from scratch?
They use python to create widgets (desklets).
Screenlets is designed for this task.
The Screenlets project is both a Python framework to simplify writing Cairo-drawn desktop widgets, similar to those found in the "Dashboard" feature of OS:X.
Widgets can be written entirely in Python. A collection of widgets using the framework have already been developed.
It is designed to work with Linux desktop. But it should be easy to port to other platforms, since Cairo is cross-platform, in my opinion.
Disadvantages
It's not updated frequently. The latest version, 0.1.6, was released on 2012-01-27
Its home page has been down for some time. Launchpad works though.
Only Python 2 is supported.
You can check out PyGTK, which will allow you to create desktop widgets, but they won't be managed by OSX's Dashboard. If you'd like to develop an OSX widget, you'll want to stick with HTML/CSS/JavaScript.
Take a look at pyqt4. It has webkit integration. I was looking into this myself but haven't really had time to dig into the API.

Categories

Resources