Issues with tKinter

Question:

This is my first time ever writing here.
Also my first time actually coding.

I’ve made a code but have issues running it due to tKinter not seeming to exist, even though I’ve specifically installed python from the official webpage and also ticked the tcl/tk options.

When trying to launch my code i get this error:

File "C:UsersNiklaDesktoproligttest.py", line 44, in
exp_bar = tk.Progressbar(exp_frame, orient=tk.HORIZONTAL, length=200, mode=’determinate’, value=20, maximum=100)
AttributeError: module ‘tkinter’ has no attribute ‘Progressbar’


This error then leads me to investigating if tkinter is installed correctly. But to my surprise I get this message:

PS C:UsersNikla> pip uninstall tkinter
WARNING: Skipping tkinter as it is not installed.
PS C:UsersNikla> pip install tkinter
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement tkinter (from versions: none)
ERROR: No matching distribution found for tkinter


Any ideas?

And keep in mind, this is my ABSOLUTE first time trying to code something.

Thanks in advance,
Niklas

I tried reinstalling tkinter, it did not exist
I tried uninstalling tkinter, it did not exist
I tried installing tkinter, it tells me "Defaulting to user installation because normal site-packages is not writable

I also get "ERROR: Could not find a version that satisfies the requirement tkinter (from versions: none)
ERROR: No matching distribution found for tkinter"-message.

Asked By: Niklas B

||

Answers:

Just use the tkk package.

from tkinter import ttk

pb = tkk.Progressbar(exp_frame, orient=tk.HORIZONTAL, length=200, mode='determinate', value=20, maximum=100)

Reference

Also tkinter is a built in package and can’t remove

Answered By: Dlunhappy226
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.