Closed WinEunuuchs2Unix closed 2 years ago
ttk.Style
and ttkthemes.ThemedStyle
are different. To actually get the themes loaded, you need to instantiate ThemedStyle
, or use ttkthemes.ThemedTk
instead of tkinter.Tk
.
Many libraries don't support Python 2, and I don't think ttkthemes will be an exception. You have a couple options:
@Akuli How do you fork and revert? Also my Python 2.7 code has imports for things like from __future__ import print_function
which kind of makes it really Python 3.x as always use print(...)
as a function. I aslo use from __future__ import with_statement
. So my Python 2.7 is really Python 3.x soon to be Python 4.x. Will this infect / effect fork & revert?
from __future__ import blah
in your code does not affect libraries you import.
Python 3 support was dropped in #66. You need to revert everything that was changed in that pull request. If you are familiar with basics of Git and GitHub, forking and reverting should both be very googlable.
Now that I look at the Git history in more detail, I realized that ttkthemes 2.4.0 supports Python 2, and it has ubuntu
and radiance
themes, so you just need to install that specific version (with e.g. pip):
(e) akuli@akuli-desktop:~$ pip install ttkthemes==2.4.0
...
Successfully installed pillow-8.3.2 ttkthemes-2.4.0
(e) akuli@akuli-desktop:~$ python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ttkthemes
>>> ttkthemes.ThemedStyle().theme_names()
['scidgrey', 'scidgreen', 'aquativo', 'scidpink', 'clam', 'scidmint', 'blue', 'elegance', 'classic', 'arc', 'black', 'winxpblue', 'itft1', 'scidsand', 'ubuntu', 'smog', 'radiance', 'equilux', 'default', 'scidpurple', 'keramik', 'clearlooks', 'kroc', 'alt', 'plastik', 'scidblue']
>>>
@Akuli Using pip
gave 5,000 lines of output which was truncated at top. Last line read:
ERROR: Command errored out with exit status 1: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-1XWv1k/ttkthemes/setup.py'"'"'; __file__='"'"'/tmp/pip-install-1XWv1k/ttkthemes/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-ZQ54ro/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/rick/.local/include/python2.7/ttkthemes Check the logs for full command output.
Sigh
pip install --upgrade pip
pip install wheel
pip install ttkthemes==2.4.0
Still errors?
@Akuli Yes still have errors after upgrading pip from 2.3.3
to 2.3.4
. To find the errors I had to resort to a little 2>
file redirection and grep
:
$ grep ERROR error.log -a2
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-MCjLVi/ttkthemes/setup.py'"'"'; __file__='"'"'/tmp/pip-install-MCjLVi/ttkthemes/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-JYSQIP
cwd: /tmp/pip-install-MCjLVi/ttkthemes/
--
error: can't copy 'ttkthemes/themes/clearlooks': doesn't exist or not a regular file
----------------------------------------
ERROR: Failed building wheel for ttkthemes
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-MCjLVi/ttkthemes/setup.py'"'"'; __file__='"'"'/tmp/pip-install-MCjLVi/ttkthemes/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-KNPTZU/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/rick/.local/include/python2.7/ttkthemes
cwd: /tmp/pip-install-MCjLVi/ttkthemes/
--
error: can't copy 'ttkthemes/themes/clearlooks': doesn't exist or not a regular file
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-MCjLVi/ttkthemes/setup.py'"'"'; __file__='"'"'/tmp/pip-install-MCjLVi/ttkthemes/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-KNPTZU/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/rick/.local/include/python2.7/ttkthemes Check the logs for full command output.
Thanks for introducing me to pip
BTW. Previously I only used sudo apt install python-xxx
I can't reproduce your problem.
~ $ sudo apt install python-pip
[sudo] salasana henkilölle akuli:
Luetaan pakettiluetteloita... Valmis
Muodostetaan riippuvuussuhteiden puu
Luetaan tilatiedot... Valmis
The following additional packages will be installed:
libjs-sphinxdoc libjs-underscore libpython-all-dev libpython-dev
libpython2-dev libpython2.7-dev python-all python-all-dev python-asn1crypto
python-cffi-backend python-configparser python-crypto python-cryptography
python-dev python-entrypoints python-enum34 python-ipaddress python-keyring
python-keyrings.alt python-pip-whl python-secretstorage python-six
python-wheel python-xdg python2-dev python2.7-dev
Ehdotetut paketit:
python-crypto-doc python-cryptography-doc python-cryptography-vectors
python-enum34-doc libkf5wallet-bin gir1.2-gnomekeyring-1.0 python-gdata
python-keyczar python-secretstorage-doc
Seuraavat UUDET paketit asennetaan:
libjs-sphinxdoc libjs-underscore libpython-all-dev libpython-dev
libpython2-dev libpython2.7-dev python-all python-all-dev python-asn1crypto
python-cffi-backend python-configparser python-crypto python-cryptography
python-dev python-entrypoints python-enum34 python-ipaddress python-keyring
python-keyrings.alt python-pip python-pip-whl python-secretstorage
python-six python-wheel python-xdg python2-dev python2.7-dev
0 päivitetty, 27 uutta asennusta, 0 poistettavaa ja 47 päivittämätöntä.
Noudettavaa arkistoa 34,5 Mt/34,6 Mt.
Toiminnon jälkeen käytetään 57,0 M t lisää levytilaa.
Haluatko jatkaa? [K/e] k
Nouda:1 http://deb.devuan.org/merged beowulf/main i386 libjs-underscore all 1.9.1~dfsg-1+deb10u1 [100,0 kB]
Nouda:2 http://deb.devuan.org/merged beowulf/main i386 libpython2.7-dev i386 2.7.16-2+deb10u1 [31,4 MB]
Nouda:3 http://deb.devuan.org/merged beowulf/main i386 libpython2-dev i386 2.7.16-1 [20,9 kB]
Nouda:4 http://deb.devuan.org/merged beowulf/main i386 libpython-dev i386 2.7.16-1 [20,9 kB]
Nouda:5 http://deb.devuan.org/merged beowulf/main i386 libpython-all-dev i386 2.7.16-1 [1 068 B]
Nouda:6 http://deb.devuan.org/merged beowulf/main i386 python-all i386 2.7.16-1 [1 044 B]
Nouda:7 http://deb.devuan.org/merged beowulf/main i386 python2.7-dev i386 2.7.16-2+deb10u1 [295 kB]
Nouda:8 http://deb.devuan.org/merged beowulf/main i386 python2-dev i386 2.7.16-1 [1 208 B]
Nouda:9 http://deb.devuan.org/merged beowulf/main i386 python-dev i386 2.7.16-1 [1 184 B]
Nouda:10 http://deb.devuan.org/merged beowulf/main i386 python-all-dev i386 2.7.16-1 [1 068 B]
Nouda:11 http://deb.devuan.org/merged beowulf/main i386 python-asn1crypto all 0.24.0-1 [78,1 kB]
Nouda:12 http://deb.devuan.org/merged beowulf/main i386 python-cffi-backend i386 1.12.2-1 [82,3 kB]
Nouda:13 http://deb.devuan.org/merged beowulf/main i386 python-configparser all 3.5.0b2-1 [59,2 kB]
Nouda:14 http://deb.devuan.org/merged beowulf/main i386 python-crypto i386 2.6.1-9+b1 [261 kB]
Nouda:15 http://deb.devuan.org/merged beowulf/main i386 python-enum34 all 1.1.6-2 [35,3 kB]
Nouda:16 http://deb.devuan.org/merged beowulf/main i386 python-ipaddress all 1.0.17-1 [18,1 kB]
Nouda:17 http://deb.devuan.org/merged beowulf/main i386 python-cryptography i386 2.6.1-3+deb10u2 [201 kB]
Nouda:18 http://deb.devuan.org/merged beowulf/main i386 python-entrypoints all 0.3-1 [5 444 B]
Nouda:19 http://deb.devuan.org/merged beowulf/main i386 python-secretstorage all 2.3.1-2 [13,8 kB]
Nouda:20 http://deb.devuan.org/merged beowulf/main i386 python-keyring all 17.1.1-1 [47,1 kB]
Nouda:21 http://deb.devuan.org/merged beowulf/main i386 python-keyrings.alt all 3.1.1-1 [18,3 kB]
Nouda:22 http://deb.devuan.org/merged beowulf/main i386 python-pip-whl all 18.1-5 [1 591 kB]
Nouda:23 http://deb.devuan.org/merged beowulf/main i386 python-pip all 18.1-5 [215 kB]
Nouda:24 http://deb.devuan.org/merged beowulf/main i386 python-wheel all 0.32.3-2 [19,3 kB]
Nouda:25 http://deb.devuan.org/merged beowulf/main i386 python-xdg all 0.25-5 [35,9 kB]
Noudettiin 34,5 Mt ajassa 24s (1 410 kt/s)
Selecting previously unselected package libjs-underscore.
(Reading database ... 326132 files and directories currently installed.)
Preparing to unpack .../00-libjs-underscore_1.9.1~dfsg-1+deb10u1_all.deb ...
Unpacking libjs-underscore (1.9.1~dfsg-1+deb10u1) ...
Selecting previously unselected package libjs-sphinxdoc.
Preparing to unpack .../01-libjs-sphinxdoc_1.8.4-1_all.deb ...
Unpacking libjs-sphinxdoc (1.8.4-1) ...
Selecting previously unselected package libpython2.7-dev:i386.
Preparing to unpack .../02-libpython2.7-dev_2.7.16-2+deb10u1_i386.deb ...
Unpacking libpython2.7-dev:i386 (2.7.16-2+deb10u1) ...
Selecting previously unselected package libpython2-dev:i386.
Preparing to unpack .../03-libpython2-dev_2.7.16-1_i386.deb ...
Unpacking libpython2-dev:i386 (2.7.16-1) ...
Selecting previously unselected package libpython-dev:i386.
Preparing to unpack .../04-libpython-dev_2.7.16-1_i386.deb ...
Unpacking libpython-dev:i386 (2.7.16-1) ...
Selecting previously unselected package libpython-all-dev:i386.
Preparing to unpack .../05-libpython-all-dev_2.7.16-1_i386.deb ...
Unpacking libpython-all-dev:i386 (2.7.16-1) ...
Selecting previously unselected package python-all.
Preparing to unpack .../06-python-all_2.7.16-1_i386.deb ...
Unpacking python-all (2.7.16-1) ...
Selecting previously unselected package python2.7-dev.
Preparing to unpack .../07-python2.7-dev_2.7.16-2+deb10u1_i386.deb ...
Unpacking python2.7-dev (2.7.16-2+deb10u1) ...
Selecting previously unselected package python2-dev.
Preparing to unpack .../08-python2-dev_2.7.16-1_i386.deb ...
Unpacking python2-dev (2.7.16-1) ...
Selecting previously unselected package python-dev.
Preparing to unpack .../09-python-dev_2.7.16-1_i386.deb ...
Unpacking python-dev (2.7.16-1) ...
Selecting previously unselected package python-all-dev.
Preparing to unpack .../10-python-all-dev_2.7.16-1_i386.deb ...
Unpacking python-all-dev (2.7.16-1) ...
Selecting previously unselected package python-asn1crypto.
Preparing to unpack .../11-python-asn1crypto_0.24.0-1_all.deb ...
Unpacking python-asn1crypto (0.24.0-1) ...
Selecting previously unselected package python-cffi-backend.
Preparing to unpack .../12-python-cffi-backend_1.12.2-1_i386.deb ...
Unpacking python-cffi-backend (1.12.2-1) ...
Selecting previously unselected package python-configparser.
Preparing to unpack .../13-python-configparser_3.5.0b2-1_all.deb ...
Unpacking python-configparser (3.5.0b2-1) ...
Selecting previously unselected package python-crypto.
Preparing to unpack .../14-python-crypto_2.6.1-9+b1_i386.deb ...
Unpacking python-crypto (2.6.1-9+b1) ...
Selecting previously unselected package python-enum34.
Preparing to unpack .../15-python-enum34_1.1.6-2_all.deb ...
Unpacking python-enum34 (1.1.6-2) ...
Selecting previously unselected package python-ipaddress.
Preparing to unpack .../16-python-ipaddress_1.0.17-1_all.deb ...
Unpacking python-ipaddress (1.0.17-1) ...
Selecting previously unselected package python-six.
Preparing to unpack .../17-python-six_1.12.0-1_all.deb ...
Unpacking python-six (1.12.0-1) ...
Selecting previously unselected package python-cryptography.
Preparing to unpack .../18-python-cryptography_2.6.1-3+deb10u2_i386.deb ...
Unpacking python-cryptography (2.6.1-3+deb10u2) ...
Selecting previously unselected package python-entrypoints.
Preparing to unpack .../19-python-entrypoints_0.3-1_all.deb ...
Unpacking python-entrypoints (0.3-1) ...
Selecting previously unselected package python-secretstorage.
Preparing to unpack .../20-python-secretstorage_2.3.1-2_all.deb ...
Unpacking python-secretstorage (2.3.1-2) ...
Selecting previously unselected package python-keyring.
Preparing to unpack .../21-python-keyring_17.1.1-1_all.deb ...
Unpacking python-keyring (17.1.1-1) ...
Selecting previously unselected package python-keyrings.alt.
Preparing to unpack .../22-python-keyrings.alt_3.1.1-1_all.deb ...
Unpacking python-keyrings.alt (3.1.1-1) ...
Selecting previously unselected package python-pip-whl.
Preparing to unpack .../23-python-pip-whl_18.1-5_all.deb ...
Unpacking python-pip-whl (18.1-5) ...
Selecting previously unselected package python-pip.
Preparing to unpack .../24-python-pip_18.1-5_all.deb ...
Unpacking python-pip (18.1-5) ...
Selecting previously unselected package python-wheel.
Preparing to unpack .../25-python-wheel_0.32.3-2_all.deb ...
Unpacking python-wheel (0.32.3-2) ...
Selecting previously unselected package python-xdg.
Preparing to unpack .../26-python-xdg_0.25-5_all.deb ...
Unpacking python-xdg (0.25-5) ...
Setting up python-enum34 (1.1.6-2) ...
Setting up python-crypto (2.6.1-9+b1) ...
Setting up libpython2.7-dev:i386 (2.7.16-2+deb10u1) ...
Setting up python-wheel (0.32.3-2) ...
Setting up python-asn1crypto (0.24.0-1) ...
Setting up python-all (2.7.16-1) ...
Setting up python-six (1.12.0-1) ...
Setting up python-xdg (0.25-5) ...
Setting up python-pip-whl (18.1-5) ...
Setting up libpython2-dev:i386 (2.7.16-1) ...
Setting up python-ipaddress (1.0.17-1) ...
Setting up libjs-underscore (1.9.1~dfsg-1+deb10u1) ...
Setting up python-cffi-backend (1.12.2-1) ...
Setting up python2.7-dev (2.7.16-2+deb10u1) ...
Setting up python2-dev (2.7.16-1) ...
Setting up python-keyrings.alt (3.1.1-1) ...
Setting up python-cryptography (2.6.1-3+deb10u2) ...
Setting up libpython-dev:i386 (2.7.16-1) ...
Setting up python-pip (18.1-5) ...
Setting up libjs-sphinxdoc (1.8.4-1) ...
Setting up python-dev (2.7.16-1) ...
Setting up python-secretstorage (2.3.1-2) ...
Setting up libpython-all-dev:i386 (2.7.16-1) ...
Setting up python-configparser (3.5.0b2-1) ...
Setting up python-all-dev (2.7.16-1) ...
Setting up python-entrypoints (0.3-1) ...
Setting up python-keyring (17.1.1-1) ...
Processing triggers for man-db (2.8.5-2) ...
~ $ python2 -m pip install --upgrade pip
Cache entry deserialization failed, entry ignored
Collecting pip
Downloading https://files.pythonhosted.org/packages/27/79/8a850fe3496446ff0d584327ae44e7500daf6764ca1a382d2d02789accf7/pip-20.3.4-py2.py3-none-any.whl (1.5MB)
100% |████████████████████████████████| 1.5MB 387kB/s
Installing collected packages: pip
Successfully installed pip-20.3.4
~ $ python2 -m pip install ttkthemes==2.4.0
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Collecting ttkthemes==2.4.0
Downloading ttkthemes-2.4.0.tar.gz (757 kB)
|████████████████████████████████| 757 kB 1.1 MB/s
Collecting pillow
Downloading Pillow-6.2.2-cp27-cp27mu-manylinux1_i686.whl (2.0 MB)
|████████████████████████████████| 2.0 MB 1.1 MB/s
Building wheels for collected packages: ttkthemes
Building wheel for ttkthemes (setup.py) ... done
Created wheel for ttkthemes: filename=ttkthemes-2.4.0-cp27-cp27mu-linux_i686.whl size=1692602 sha256=687f756bf270a13d56b6ecf5d260c2a7bc6d1209907dd7c26ac933fd605caa29
Stored in directory: /home/akuli/.cache/pip/wheels/7d/8f/d8/7fc3019d9036a22e80b10bb10c19893baff26af9fe31aba101
Successfully built ttkthemes
Installing collected packages: pillow, ttkthemes
Successfully installed pillow-6.2.2 ttkthemes-2.4.0
~ $
Which distro are you using?
@WinEunuuchs2Unix pip==2.3.4
is extremely old. I can't find the tag on the pip
GitHub repository, but given how 6.0 was in 2014, I'd say 2.3.4 is from before that. From the top of my head pip
dropped support for Python 2 around version 20.x.x
or so, so you should be able to install a much newer version of pip
.
May I ask why you still use Python 2.7? It is deprecated after all, and I won't be making a new ttkthemes
package that is compatible with Python 2. The biggest reason for that is having to think around support for Tk 8.5, which complicates the theme loading mechanisms. You are free to set that up yourself: It's definitely possible if you have some time to spend on it. First rewrite the tkinter
imports to support Python 2, and work your way through the code from there. If you have Tk 8.6, it should not be too hard.
What is probably going wrong now is that you have a really old version of setuptools
as well. Try this:
python -m pip install -U pip setuptools wheel
python -m pip install ttkthemes==2.4.0
pip==2.3.4 is extremely old
I assumed it was a typo. From my pip output, you can see that you get pip==20.3.4
by updating it on Python 2.
@Akuli is correct it was a typo. I will try above suggestions after work but for the time being:
$ pip --version
results in:
pip 20.3.4 from /home/rick/.local/lib/python2.7/site-packages/pip (python 2.7)
As far as 2.7 support goes, my program is written to support python 2.7 or 3.x. Later I will extend to support Mac and Windows. Even some day Android Auto I hope. Because corporations can invest millions in software and lock it in for decades I thought learning both python 2.7 and 3.x a good move.
@Akuli SUCCESS! I googled error message which led to here: https://github.com/python-openxml/python-docx/issues/594
That link told me to run this:
$ pip install -U setuptools
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Collecting setuptools
Using cached setuptools-44.1.1-py2.py3-none-any.whl (583 kB)
Installing collected packages: setuptools
ERROR: pip's legacy dependency resolver does not consider dependency conflicts when selecting packages. This behaviour is the source of the following dependency conflicts.
launchpadlib 1.10.3 requires testresources, which is not installed.
Successfully installed setuptools-44.1.1
Now installation is successful:
$ python2 -m pip install ttkthemes==2.4.0 2> error.log
Defaulting to user installation because normal site-packages is not writeable
Collecting ttkthemes==2.4.0
Using cached ttkthemes-2.4.0.tar.gz (757 kB)
Requirement already satisfied: pillow in /usr/lib/python2.7/dist-packages (from ttkthemes==2.4.0) (3.1.2)
Building wheels for collected packages: ttkthemes
Building wheel for ttkthemes (setup.py) ... done
Created wheel for ttkthemes: filename=ttkthemes-2.4.0-cp27-cp27mu-linux_x86_64.whl size=1694955 sha256=656caee6a2009dccb1ae713b0f740e7a9af676a865faaea0f293d337b392075a
Stored in directory: /home/rick/.cache/pip/wheels/7d/8f/d8/7fc3019d9036a22e80b10bb10c19893baff26af9fe31aba101
Successfully built ttkthemes
Installing collected packages: ttkthemes
Successfully installed ttkthemes-2.4.0
Thanks for both of yours help. I'll close the comment now :)
It is a bit unfortunate that you used Python 2 successfully, but I'm glad I don't need to help with Python 2 more :)
Not sure if this is a silly question but in Python 2.7.12 when I use:
I get:
I'm interested in 'radiance' and 'ubuntu' themes but Python 2.7 support was dropped January 2021 or so.
How exactly would I get a version from December 2020 and manually copy it to my Linux distribution?
I can use
sudo apt install python3-ttkthemes
but that is the wrong version.BTW TCL version is 8.6 and I'm not sure about TkImg.