Python Forum

Full Version: Which version of python goes well with tkinter?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi,

Before I get started, I would like to admire the efforts of forum admins, moderators, and members for their excellent contributions in maintaining this forum as one of the best places to discuss python. I'm planning to create a windows desktop app with python and tkinter. I would like to know which python version I should use to ensure smooth development curve, 2.7, 3.1, or the latest. I appreciate people's cooperation.
For any new project, it's recommended to use the latest python version, which right now would be 3.6.
Also, tkinter is pretty limited in what it gives you out of the box, you might want to consider a more modern gui toolkit.
@stranac I thought tkinter was the best gui toolkit on python. What do you recommend? Why do you think tkinter isn't modern?
Tkinter is ugly and lacks features, its only advantage is that it comes packaged with python.
Haven't made any GUIs lately, but AFAIK https://wiki.qt.io/PySide and https://www.wxpython.org/ are still probably the most popular options.
I appreciate your help.
I am running Linux Mint 18.2 and have python 2.7.12,  3.5.2 and 3.6.3 installed.
I do understand that they might, ultimately, be more versatile than tkinter but I have tried pyside and wxpython and am not impressed with getting either to work with python 3.x.
In fact it always fails. I have tried looking through the error messages and installing what it complains about but after setting up quite a few I have given up as I don't want to end up messing up what I already have.
I see no point in using them under 2.7 as I understand it will soon stop being developed. I can use tkinter with both but only use it under 3.x.
If it gets to the point where either are in the repositories I might try them although the syntax seems to involve far more typing to do anything compared to tkinter.

Just in case anyone might be able to help here is what happened when I tried to work through the list for wxpython.
Everything was fine until libnotify gave the following error
Quote:Traceback (most recent call last):
  File "/usr/lib/linuxmint/mintinstall/AptClient/AptClient.py", line 74, in _run
    cache.commit(acquire_progress_monitor, install_progress_monitor)
  File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 512, in commit
    res = self._fetch_archives(fetcher, pm)
  File "/usr/lib/python2.7/dist-packages/apt/cache.py", line 342, in _fetch_archives
    if not pm.get_archives(fetcher, self._list, self._records):
SystemError: E:Failed to create IPC pipe to subprocess - pipe (24: Too many open files)

freeglut3,  libsm-dev, libgtk2.0-dev and libwebkitgtk-dev
gives similar errors

Freeglut3-dev
says the following packages will be removed:
Quote: libgles2-mesa
 libglapi-mesa:i386
 libglapi-mesa
 libgl1-mesa-glx:i386
 libgl1-mesa-glx
As I don't know if that would impact on anything I already have installed I cancelled it.
The new wxpython phoenix is very nice, and easy to use, see: https://wxpython.org/Phoenix/docs/html/gallery.html
and: https://pypi.python.org/pypi/wxPython/4.0.0b2
see: https://python-forum.io/Thread-wxPython-...ep-by-step
It is designed for Python 3.
The demo is exhaustive, and has code display for each and every example.

I have used tkinter extensively and as stranac says, it is ugly unless you you want to spend a lot of time customizing it.
It is also extremely difficult to get the geometry correct in anything other than the simplest of applications.

You can also use Qt5 (https://pypi.python.org/pypi/PyQt5/5.9.2) which is very nice, although I don't know how much longer they will suport a community edition.

I have been using wxpython phoenix and am very happy with it
Reading further down in this article
https://github.com/wxWidgets/Phoenix/blo...README.rst
it said newer versions of Linux might need libgtk-3-dev and libwebkitgtk-3.0-dev.

So I found they were in the repository and installing them updated a lot of other stuff and then all the others such as libnotify installed so they needed to be added before libnotify and the others not after them.

Still, although wx is now found in python 3.5.2 it isn't in 3.6.3
pip only installs one version, which ever is the active version
You can find this with python -V
I believe in Linux that you use pip3 for python 3, and to run python 3, use python3

the wx version for python 2 is the old code, and I don't think it's maintained anymore.
Which version of python are you using?

If 2.7 switch now, don't get bogged down in a version which will only be supported for a couple more years.
Most new code will be written for python 3, not 2, and only sometimes both,
Yes, I have been using pip for 2.7 and pip3 for 3 but it only installs for 3.5.2 and there isn't an option to say which version of 3.x so python -V gives 2.7.12 and python3 -V gives 3.5.2.
I guess it's the symbolic links. I will have a look to see if I can change it. No point in using 3.5 instead of 3.6.
Update.
I did the following:
cd /usr/bin
sudo rm python3
sudo ln -s python3 python3.6
sudo pip3 install wxpython
That has fixed it. Be aware that the install takes a while - about 15 minutes on my 2.8GHz processor with 16 Gig ram
Pages: 1 2