Posts: 7
Threads: 1
Joined: Jul 2024
I cannot use tkinter on my Windows install. Even the most basic example fails in the same way:
>>> from tkinter import *
>>> Window = Tk()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python\Python312\Lib\tkinter\__init__.py", line 2346, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_tkinter.TclError: unknown color name "rgb:33/33/33" I've tried uninstalling/reinstall python, using tk from pip (I know I shouldn't though), removing python from my cygwin environment, running from a venv - same error every time. No idea what could be causing this. Any suggestions?
Posts: 11,993
Threads: 481
Joined: Sep 2016
what is your OS?
Which version of python are you running?
How did you install tkinter?
tkinter is packaged with most (but not all) python versions and does not require further installation.
Posts: 7
Threads: 1
Joined: Jul 2024
(Jul-25-2024, 09:34 AM)Larz60+ Wrote: what is your OS?
Which version of python are you running?
How did you install tkinter?
tkinter is packaged with most (but not all) python versions and does not require further installation.
Windows 10, I've tried python 3.12.4 and 3.11.9, uninstalling & deleting between versions. I'm installing python and tkinter using the standard windows python GUI installer, ensuring the "tcl/tk and IDE" checkbox is checked during optional features selection.
Posts: 11,993
Threads: 481
Joined: Sep 2016
I don't use MS windows much, but I use several versions of python (including 3.12.4) and tkinter is installed with the package.
My installs are all from pyenv (which I'd recommend using see this)
I expect that the python.org version for windows includes tkinter.
try running python -m tkinter from the command line, ( doc here )
if everything was installed properly, a simple tkinter window should appear.
Posts: 7
Threads: 1
Joined: Jul 2024
(Jul-26-2024, 12:59 AM)Larz60+ Wrote: I don't use MS windows much, but I use several versions of python (including 3.12.4) and tkinter is installed with the package.
My installs are all from pyenv (which I'd recommend using see this)
I expect that the python.org version for windows includes tkinter.
try running python -m tkinter from the command line, ( doc here )
if everything was installed properly, a simple tkinter window should appear.
Thanks for the support. Same bug:
Microsoft Windows [Version 10.0.19045.4353]
(c) Microsoft Corporation. All rights reserved.
C:\Users\kevin>python -m tkinter
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Python\Python312\Lib\tkinter\__main__.py", line 7, in <module>
main()
File "C:\Python\Python312\Lib\tkinter\__init__.py", line 4655, in _test
root = Tk()
^^^^
File "C:\Python\Python312\Lib\tkinter\__init__.py", line 2346, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_tkinter.TclError: unknown color name "rgb:33/33/33"
C:\Users\kevin>
Posts: 7
Threads: 1
Joined: Jul 2024
This is somehow related to my Windows user profile. I was able to create a new user in Windows and tkinter works perfectly fine on that account. *shrug*
Posts: 7
Threads: 1
Joined: Jul 2024
Ok, I'm getting somewhere now. It's gotta be a weird cygwin interaction. The following gets it to work:
set "HOME="
set "HOMEDRIVE="
set "HOMEPATH="
set "USERPROFILE="
Posts: 7
Threads: 1
Joined: Jul 2024
Further down the hole. I have a .Xdefaults file in my user home directory. Removing this file solves the issue. Now to figure out what in that file is the problem.
Posts: 7
Threads: 1
Joined: Jul 2024
Narrowed it down to these two lines:
*background: rgb:33/33/33
*foreground: rgb:ff/ff/ff
*Sigh* At least it's fixed.
Gribouillis likes this post
Posts: 11,993
Threads: 481
Joined: Sep 2016
kwolfe81 Wrote:*Sigh* At least it's fixed. Glad to hear it.
|