Learning GUI programming with GTK+2 or GTK+3? - user-interface

I am new to GUI programming, and I haven't found yet what library is best for my purpose (i want to make desktop environment applications, eg. docks, panels, desklets etc.)
I have started learning basics of GTK, mainly using PyGtk. Most tutorials i found on line are for GTK+2.0. Recently however, GTK+3 has been released. So i am a bit unsure as to what that means for my learning curve:
Should i learn using GTK+3 and forget about GTK+2?
Does using one or the other really makes a difference from the point of view of coding?
Are there PyGTK bindings for GTK+3 already?
Is there any available tutorial for GTK+3?
Since i'm new to this, i'm throwing myself into it blindly, but a bit of guidance may be wiser. So if you have any, you're welcome :)

Definitely go with GTK 3. The 10-minute tutorials on http://developer.gnome.org/ use GTK 3 and are an excellent introduction to programming with GTK in several languages, including Python. In the coming months you will probably see more tutorials appear for GTK 3, and in the meantime, you will still be able to get most tutorials for GTK 2 to work with a minimum of fuss. The basics aren't all that different.

Although late, I would like to share this information in the hope that it will be useful for anyone who have this doubt in future.
As ptomato said, GTK+ 3 is the way to go and much of the GTK+2 knowledge is applicable to GTK+3 also. PyGObject is the way to go with GTK+3, not PyGTK. See: PyGTK, GObject, and GNOME 3 to get an overall idea about this new change.
To know what differs and how to cope up with these changes, see:
Migrating from GTK+ 2.x to GTK+ 3
Porting Documentation
About the tutorials, following ones will be of helpful:
The Python GTK+ 3 Tutorial
GNOME Developer Platform Demos
Screen-casts by daniel g. siegel
GTK+ 3 Reference Manual

Related

Does QtRuby work with Qt 5?

Everything I can find online about QtRuby uses Qt 4, but the current version of Qt is 5. Is this simply a matter of documentation not catching up with reality, where Qt 5 would work just fine with QtRuby?
If you assert that this is the case (that Qt5 is unsupported) then please backup your assertion with evidence.
QtRuby
Qtruby and korundum are not maintained for years now. To get a maintained version of qtruby, install qtbindings as ruby gem.
Qtbindings home page: https://github.com/ryanmelt/qtbindings/
Also see https://github.com/ryanmelt/qtbindings/issues/131 for a discussion about supporting Qt5.
Ruby-QML
Ruby-qml is a QML / Qt Quick wrapper for Ruby. It provides bindings between QML and Ruby and enables you to use Qt5 Quick-based GUI from Ruby.
The bindings provided by Ruby-QML are much leaner in comparison to QtRuby. In particular there is no direct access to the Qt classes' methods. That might first seem to be a a disadvantage when coming from QtRuby.
When learning to use use Ruby-QML, it turns out quickly that the advantages outweigh the limitations:
QML and JS greatly complement to describe and model the static and dynamic aspects of the UI
The user community of QML/JS is huge. It is so much easier to find examples or help to solve QML/JS issues, than it was within the tiny QT/Ruby community.
The examples on Ruby-qml are pretty much complete to demonstrate the constructs needed to get started.
JS may be used as flexible 'glue logic' between Ruby and Qt.
QtRuby only supports Qt 4 for the time being. Hopefully, it will change soon, but this seems to be the reality at the time of writing this.
The last release happened two and half a years ago as the time of writing this. That can be seen here:
http://rubyforge.org/projects/korundum/
As you can see, that is also a Qt 4 release as its name says: qt4-qtruby-2.2.0.
That information is also getting from their outdated KDE Wiki in here:
http://techbase.kde.org/Development/Languages/Ruby
If this is still not enough proof, you can look into the code yourself to see it is not actually binding Qt 5 classes added in that major Qt variant.
Here is a quick ls after decompressing the latest tarball:
lpapp ~/Downloads/qt4-qtruby-2.2.0/qtruby/src/lib $ ls
CMakeLists.txt Qt Qt.rb Qt3.rb Qt4.rb

Modern GUI programming in Python 3.3

I am putting together a few programs, and it's about time to start making GUI's for some of them. The code is currently written in Python 3.3.
I have researched a few GUI's for Python, namely Tkinter, wxPython and PyGTK. Everything I am finding seems to only create GUI's that look fairly archaic. I have created a couple of example GUI's, and they all work, they just look very Windows 95.
An example of what I am finding/creating:
An example of what I want-ish:
Is it simply an advanced knowledge of how the GUI's work, or are there just GUI modules more suited for "modern" looking GUI's?
If it is advanced knowledge of how the GUI's work, are there some tutorials out there for how to make GUI's look more "modern".
Thanks in advance.
Tkinter comes with a set of widgets called "themed tk", provided by the ttk module. It provides more modern-looking alternatives to some of the core widgets such as buttons and labels, and it also has a few new widgets such as a notebook and tree.
After a lot of research I've decided to use the Qt bindings library for Python called PyQt5 (http://www.riverbankcomputing.com/software/pyqt/download5). It's quite easy to implement and has tons of documentation. The interface elements (called widgets in Qt) look exactly like the ones in the host operating system: if you run the program in Windows 95, they'll look like that, same for Windows 7, and even MacOS. I find Qt extremely powerful. I'm developing a Python/MySQL application and the QtSql module helps a lot in the development with creating tables.
You can use htmlPy. So you can create GUI's with css html js with good looks.
QT is a good choice in many cases, but sometimes you need much faster response time, or native support of OpenGL(ES), or just another license. There are a lot of alternatives:
GUI Programming in Python (many specific frameworks): https://wiki.python.org/moin/GuiProgramming
The most widespread cross-platform GUIs: https://docs.python.org/2/library/othergui.html

Are there any benefits to using Python for GUI development?

I was looking into Tkinter, but I was wondering if there are any other packages that help with GUI. Even though Java is more robust than python, python is faster to write and would be very helpful if I am just trying to create a quick application. I usually use .Swing and .awt in java to make all of my applications.
Also, Is there something similar to JWS for python? I am looking to add a link on a website that will fire up a python coded application
Thanks
(P.S. I'm using Python 3.2.2)
I love using tkinter with python. It is pretty easy to do, there are lots of examples, and numerous questions with answers on here too! Also, 90% of people with python have tkinter already on their system, making distribution pretty straight forward. I also have had success using py2exe to create windows executables.
Here is a gui that I wrote in all of ~10 minutes. Once you understand the syntax it is very easy.
And another more elaborate one that I wrote with vtk and matplotlib embedded into the gui for 3D and 2D graphics! The question I asked with this.
Yes, python and tkinter are excellent for developing GUIs. While this is true of most scripting languages, I think these two make a particularly good combination.
For most GUIs, functionality is more important than form (ie: eye candy is not top priority). Even then, it's possible to make very nice looking GUIs with Tkinter. Tk has been my go-to toolkit for close to twenty years. It is most easily used with Tcl since that is its native language, but there's no denying the advantage python has over Tcl as far as built-in functionality goes.
That being said, all of the toolkits available to a python programmer are good. Tkinter's main advantages are that it is extremely easy to use and you probably already have it installed, so the barrier for entry is very low.

Python 3.x website and app GUI

I am only starting out to learn programming, currently on Python 3.2, and was looking to build a few simple applications and possibly website(s), also simple. I want to know a good GUI library to start that:
is simple with good control (not a major issue, I'm planning to advance as much as possible anyway);
is cross-platform, with a native feel;
has good tutorials somewhere (please post link);
I can use to sell applications/make profit from websites with little to no licensing issues (a must);
can use Chinese characters as strings (not a must, but would definitely be a game changer).
Thanks a lot!
There are two main options for cross platform GUIs in Python 3:
Tkinter is simple and ships with Python, but applications can look a bit ugly. I like this site for learning it, although it's a bit old.
Qt is bigger and more complex, but produces powerful, good looking applications. If you want to make proprietary software with it, you'll need to use PySide, rather than PyQt, but how you use them is almost identical. There are plenty of tutorials online (mainly for PyQt, which has been around longer, but they're fine if you're using PySide).
Both should handle any characters, including Mandarin, so long as the system has fonts with those characters to display them.
Most of the tutorials for both will be based on Python 2, so you'll have to make a few changes. print "foo" becomes print("foo"), and Tkinter becomes tkinter, for example.

Ruby GNOME GUIs

With the recent release of GNOME 3 and Ubuntu moving to Unity, what toolkit should rubyists be using to develop their apps? I know that there are bindings to GTK2, are these still ok to use?
It is still OK to use the GTK 2 bindings - GTK 2 and 3 will be installed in parallel on most desktop distributions for several years yet. That said, you should keep in mind while you're writing your application that you should update it to GTK 3 when those bindings become prevalent. Take a look at the differences between GTK 2 and 3 and don't write code that will be hard to port when the time comes.
Take a look at visualruby. It uses GTK2, which has been around for a while, so its stable. Its specifically designed for making ruby GUIs:
http://visualruby.net
I've heard good things about ruby shoes although never tried it myself. Maybe you should check it out?

Resources