I would like to try to write a GUI application in Python. I found out that there are a lot of ways to do it (different toolkits). And, in this context, I have several basic (and I think simple) question?
Is it, in general, a good idea to write a GUI application in Python?
What is the standard (easiest and most stable) way to create a GUI applications in Python?
Does anybody can give me a link to a simple Hello World GUI application written in Python?
The amount of code required to implement custom GUIs is much shorter using PySimpleGUI than if the same GUI were written directly using Tkinter or Qt. PySimpleGUI code can be “ported” between GUI frameworks by changing import statements.
Hello world in PyQt:
import qt,sys
a = qt.QApplication(sys.argv)
w = qt.QPushButton("Hello World",None)
a.setMainWidget(w)
w.show()
a.exec_loop()
I am really fond of pygtk and glade. Pygtk is a python binding for gtk, the gui toolkit used in gnome. Glade is a user interface designer which stores a gui as xml, which can be loaded in pygtk.
If you want to see some example code, you can take a look at my project https://launchpad.net/pumped. Just download the source.
If you're looking to make a fairly simple GUI, then PyGTK is extremely easy to use:
http://www.pygtk.org/
A tutorial (with downloadable sample code) can be found here, and another one on the Wiki.
As an answer for #1: Yes. It is quite good for this; scripting languages with GUI toolkits are often a good way to put a GUI on an application. They can also be used to wrap applications written in low level languages such as C or C++. Python offers good integration to quite a few toolkits. The posting linked above gives a pretty good cross section of the options with code samples.
For #2: TkInter comes with the standard distribution. It is easy to use but not as sophisticated as (say) QT or WxWidgets.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With