12

I'm looking forward to develop a desktop application using Python. I'm a beginner and I don't have sufficient expertise in Python. I'm also a Java programmer. Although I have some experience in building UIs using Swing, I see that apps developed on Swing are too damn slow. Well this might be one reason why many of the major implementations are done in C/C++ as in browsers/games.

Developing a UI in C++ might be a better option but I prefer to chose a high level programming language over C/C++. So I have opted for Python presuming that it would perform well over Java Swing as Python itself is natively build on C/C++.

So can I go ahead with this assumption that Python is better than Java Swing to develop an UI? Or do you suggest a language that is better than Python to develop UIs? If at all I go ahead with Python, which toolkit should I use Tkinter or wxPython and why?

4
  • 5
    Your assumptions seems flawed. Python is built on C/C++, but so is the JVM (most likely).
    – user281377
    Jun 15, 2011 at 8:21
  • Why limit yourself to Tkinter and wxPython?
    – Anto
    Jun 15, 2011 at 9:15
  • 2
    I am not trying to limit myself. I was under the impression that these were the two well known toolkits for GUI development. Jun 17, 2011 at 5:17
  • The Lazarus IDE, Free Pascal Compiler, and Object Pascal makes for a very fast and easy way to develop GUIs.
    – Geoffrey
    Sep 21, 2011 at 10:24

8 Answers 8

15

I have just started development of a windows desktop app, using python. I am using PyQt.

It's very easy to install and get up and running. The tutorial here: http://zetcode.com/tutorials/pyqt4/firstprograms/ shows how easy, I'll show the code:

#!/usr/bin/python

# simple.py

import sys
from PyQt4 import QtGui

app = QtGui.QApplication(sys.argv)

widget = QtGui.QWidget()
widget.resize(250, 150)
widget.setWindowTitle('simple')
widget.show()

sys.exit(app.exec_())

That gets you a window up.

I chose Python/PyQt over C#/WPF because I want to learn python and my employer is giving me the time.

My manager recommended PyQt to me over other frameworks, as in his experience it's easier to use.

2
5

If you're looking to develop a native GUI for Windows or OSX, I'd advise using Tkinter (i.e., the GUI library Tk with pythonic clothes on) as that gets you much closer to the native look than wxPython (wxWidgets for python). I'm not finding it easy to quantify, but to my eyes the Windows and OSX screenshots. YMMV. I do know that Tk (important: with the Ttk widget set) is very strongly native looking.

If you're developing for Linux… I can't really honestly advise one over the other, as I've lost track what the current favored platform look is there. :-)

3
  • 1
    Note that Tkinter does not provide many commonly used widgets out of the box. For example, if you want a progress bar you'll have to either write one yourself or find one someone else has written.
    – James
    Jun 15, 2011 at 16:50
  • 1
    Wait, but wxWidgets uses native GUI elements. At least, the C++ bindings do. I'm not so sure about Python.
    – Zhehao Mao
    Jun 16, 2011 at 2:09
  • @ZhehaoMao wxWidgets is a mix of native and non-native elements. Some elements look similar to the native ones, but are actually custom-built for a more uniform API. Sep 11, 2018 at 3:27
3

I would say it's a good choice if you already know and like Python. Otherwise, use the language you already know, which is Java. The one exception here is if this is a learning project, in which case I would suggest that getting experience with other languages would be a good idea.

My point here is that Python is not really any better or worse than Java for UI applications, so use whichever tool you like working with.

1

The only real advice one can give for all questions like this is "give it a try and see if you like it" - other peoples opinions on programming languages (particularly on what may be their most loved or most hated languages) are rarely worth much.

However, my 5 cents worth - for knocking up quick, simple Windows GUIs, the combination of Python and wxWidgets works very well. But as I said, try it for yourself - you can put together something simple but useful in an hour or so, even without much Python experience (I certainly don't have much).

1

In case anyone ends up here via search engine: you can quickly generate some Tkinter examples using the PAGE generator. It generates some decent code that will give you the idea of what it will take to get where you are wanting to go. It definitely requires you to acquiesce to generality, as the author states, but for someone wanting to test the waters or get a general idea of where they are going it is a good tool. PAGE on SourceForge.

0

You can consider Python as a fair option for this. If you are into Python and want a modern looking GUI, try Customtkinter. It is not available by default but can be installed. it is built on the basic principles of tkinter but more modern. install it with the command:

    $pip3 install customtkinter        

in the command line.

-1

I think certain types of applications are fairly managable to write in Python.

For example Task Coach is written in Python/wxPython. They use a Python2exe compiler like py2app, py2exe etc to create cross-platform, native-looking executables.

-1

If you are restricted to developing in the Windows ecosystem, and use Visual Studio, then consider Iron Python. Iron Python is Python plus .NET objects.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.