Modulenotfounderror no module named tkinter windows

For some reason, I can't use the Tkinter or tkinter module. After running the following command in the python shell import Tkinter or import tkinter I got this error ModuleNotFoundError: No ...

For some reason, I can’t use the Tkinter or tkinter module.
After running the following command in the python shell

import Tkinter

or

import tkinter

I got this error

ModuleNotFoundError: No module named ‘Tkinter’

or

ModuleNotFoundError: No module named ‘tkinter’

What could be the reason for and how can we solve it?

Brian Tompsett - 汤莱恩's user avatar

asked Sep 18, 2014 at 6:19

RasmusGP's user avatar

0

You probably need to install it using something similar to the following:

  • For Ubuntu or other distros with Apt:

    sudo apt-get install python3-tk
    
  • For Fedora:

    sudo dnf install python3-tkinter
    

You can also mention a Python version number like this:

  • sudo apt-get install python3.7-tk
    
  • sudo dnf install python3-tkinter-3.6.6-1.fc28.x86_64
    

Finally, import tkinter (for Python 3) or Tkinter (for Python 2), or choose at runtime based on the version number of the Python interpreter (for compatibility with both):

import sys
if sys.version_info[0] == 3:
    import tkinter as tk
else:
    import Tkinter as tk

Mark Amery's user avatar

Mark Amery

137k78 gold badges401 silver badges450 bronze badges

answered Sep 18, 2014 at 6:26

d-coder's user avatar

d-coderd-coder

12k4 gold badges25 silver badges35 bronze badges

4

As you are using Python 3, the module has been renamed to tkinter, as stated in the documentation:

Note Tkinter has been renamed to tkinter in Python 3. The 2to3 tool
will automatically adapt imports when converting your sources to
Python 3.

answered Sep 18, 2014 at 6:27

Burhan Khalid's user avatar

Burhan KhalidBurhan Khalid

167k18 gold badges242 silver badges278 bronze badges

0

If you’re using python 3.9 on Mac, you can simply install tkinter using brew:

brew install python-tk@3.9

This fixed it for me.

Edit:
As mentioned by others, you can also use the general command to install the latest version:

brew install python-tk

answered Apr 10, 2021 at 18:11

P1NHE4D's user avatar

P1NHE4DP1NHE4D

9308 silver badges14 bronze badges

1

For windows 10, it is important to check in the Python install the optional feature «tcl/tk and IDLE». Otherwise you get a ModuleNotFoundError: No module named ‘tkinter’. In my case, it was not possible to install tkinter after the Python install with something like «pip install tkinter»

answered Jan 29, 2020 at 15:43

Andi Schroff's user avatar

Andi SchroffAndi Schroff

1,0781 gold badge11 silver badges18 bronze badges

3

To install the Tkinter on popular Linux distros:

Debian/Ubuntu:

sudo apt install python3-tk -y  

Fedora:

sudo dnf install -y python3-tkinter

Arch:

sudo pacman -Syu tk --noconfirm 

REHL/CentOS6/CentOS7:

sudo yum install -y python3-tkinter

OpenSUSE:

sudo zypper in -y python-tk

bfontaine's user avatar

bfontaine

17.3k13 gold badges73 silver badges100 bronze badges

answered Feb 20, 2021 at 13:31

amzy-0's user avatar

amzy-0amzy-0

2852 silver badges5 bronze badges

4

You might need to install for your specific version, I have known cases where this was needed when I was using many versions of python and one version in a virtualenv using for example python 3.7 was not importing tkinter I would have to install it for that version specifically.

For example

sudo apt-get install python3.7-tk 

No idea why — but this has occured.

answered May 20, 2020 at 17:31

deMangler's user avatar

deManglerdeMangler

4173 silver badges14 bronze badges

0

For Mac use:

brew install python-tk

imxitiz's user avatar

imxitiz

3,8101 gold badge8 silver badges33 bronze badges

answered Jan 21, 2022 at 21:24

Diego Medeiros's user avatar

1

Installing Tkinter

python -m pip install tk-tools

or

sudo apt install python3-tk

answered Sep 26, 2021 at 13:11

Mr.Programmer nope's user avatar

2

For Windows 10 using either VSCode or PyCharm with Python 3.7.4 — make sure Tk is ticked in the install. I tried import tkinter as xyz with upper/lower t and k‘s and all variants without luck.

What works is:

import tkinter
import _tkinter
tkinter._test()

An example in action:

import tkinter
import _tkinter

HEIGHT = 700
WIDTH = 800

root = tkinter.Tk()

canvas = tkinter.Canvas(root, height = HEIGHT, width=WIDTH)
canvas.pack()

frame = tkinter.Frame(root, bg='red')
frame.pack()

root.mainloop()

answered Sep 7, 2019 at 3:29

Jeremy Thompson's user avatar

Jeremy ThompsonJeremy Thompson

59.7k32 gold badges184 silver badges308 bronze badges

4

check the python version you have installed by using command python --version

check for the Tk module installed correctly from following code

sudo apt-get install python3-tk 

Check if you are using open-source OS then

check the tkinter module in the following path
/home/python/site-packages/tkinter
change the path accordingly your system

barbsan's user avatar

barbsan

3,36811 gold badges21 silver badges28 bronze badges

answered Jul 24, 2019 at 9:56

Devaliya Pratik's user avatar

On CentOS7, to get this working with Python2, I had to do:

yum -y install tkinter

Noting this here because I thought that there would be a pip package, but instead, one needs to actually install an rpm.

answered Feb 3, 2020 at 19:57

Frederick Ollinger's user avatar

Make sure that when you are running your python code that it is in the python3 context. I had the same issue and all I had to do was input the command as:

sudo python3 REPLACE.py

versus

sudo python REPLACE.py

the latter code is incorrect because tkinter is apparently unnavailable in python1 or python2.

answered Nov 28, 2019 at 20:42

Owen Preece's user avatar

3

You just need to install it and import them your project like that :

this code import to command line :

sudo apt-get install python3-tk 

after import tkinter your project :

from tkinter import *

answered Dec 8, 2019 at 6:33

Jafar Choupan's user avatar

1

I resolved my issue in the PyCharm do following

  1. Install Python Interpreter from https://www.python.org/
  2. PyCharm > Preferences > Python Interpreter > Add
  3. Select installed interpreter
  4. In the run configuration select the newly installed interpreter

I also made a video instruction what I did https://youtu.be/awaURBnfwxk

answered Nov 25, 2021 at 15:50

Dima Portenko's user avatar

Dima PortenkoDima Portenko

3,2143 gold badges33 silver badges48 bronze badges

For Windows I had to reinstall python and make sure that while installing in Optional Features I had «tcl/tk and IDLE» enabled.

answered Sep 2, 2022 at 15:45

Sout parl's user avatar

Tkinter should come with the latest Python, I don’t think it comes with Python2. I had the same problem but once. I upgraded to Python 3.8 Tkinter was installed.

Sabito stands with Ukraine's user avatar

answered Jun 10, 2020 at 14:14

Eloni's user avatar

EloniEloni

293 bronze badges

$ sudo apt-get install python3.10-tk

answered Jan 14, 2022 at 10:20

devp's user avatar

devpdevp

2,4502 gold badges15 silver badges24 bronze badges

tkinter comes with python… uninstall python, reinstall it, you’re done

answered Apr 12, 2020 at 5:54

PythonProgrammi's user avatar

PythonProgrammiPythonProgrammi

21.7k3 gold badges39 silver badges34 bronze badges

0

if it doesnot work in pycharm you can add the module in the project interpreter by searching in +button python-tkinter and download it.

answered Jul 12, 2020 at 4:27

santosh ghimire's user avatar

Check apt for tasks, it may be marked for removed

sudo apt autoremove

Then check and install needed

answered Apr 23, 2020 at 6:02

Sergey Shamanayev's user avatar

We can use 2 types of methods for importing libraries

  1. work with import library
  2. work with from library import *

You can load tkinter using these ways:

  1. from tkinter import*

  2. import tkinter

Delrius Euphoria's user avatar

answered May 5, 2021 at 11:16

رضا آلناصر's user avatar

You’ll probably need to install Tkinter.
You can do so like this in the Windows command prompt:

pip install tk

answered Jan 25 at 6:26

AngusAU293's user avatar

try:
    # for Python2
    from Tkinter import *   ## notice capitalized T in Tkinter 
except ImportError:
    try:
        # for Python3
        from tkinter import *   ## notice lowercase 't' in tkinter here
    except:
        try:
            print "Download Tkinter" ##python 2
        except SyntaxError:
            print("Download Tkinter") ##python 3

answered Mar 31, 2021 at 2:43

Rodrigo Alvaro Santo SD 6's user avatar

0

If you have pip on your path, you could (in your command prompt) just type
pip install tkinter
Most versions of python already come with tkinter.

answered Feb 8, 2022 at 20:40

GL32's user avatar

1

——— WORKED ON PYTHON 2.7————

Install all below packages

sudo apt-get install git
sudo apt-get install python-tk
sudo apt-get install python-pip
sudo apt install picolisp
sudo -H pip2 install --upgrade pip
sudo pip install -I pillow
sudo apt-get install python-imaging-tk
sudo apt-get install python-tk

answered May 4, 2020 at 11:11

RAHUL 's user avatar

RAHUL RAHUL

234 bronze badges

1

Firstly you should test your python idle to see if you have tkinter:

import tkinter

tkinter._test()

Trying typing it, copy paste doesn’t work.

So after 20 hours of trying every way that recommended on those websites figured out that you can’t use «tkinter.py» or any other file name that contains «tkinter..etc.py». If you have the same problem, just change the file name.

fcdt's user avatar

fcdt

2,3315 gold badges12 silver badges26 bronze badges

answered Sep 20, 2020 at 9:38

Mehmet Nergiz's user avatar

cmd — terminal

pip install tkinter

answered Jan 22, 2022 at 9:10

Egemen İm's user avatar

1

There’re lot ports of PySimpleGUI, basic one is PySimpleGUI which is tkinter port and all GUI code are based on tkinter module. Some other ports are based on Qt, WxPython, and Remi.

The tkinter package (“Tk interface”) is the standard Python interface to the Tk GUI toolkit. Both Tk and tkinter are available on most Unix platforms, as well as on Windows systems. (Tk itself is not part of Python; it is maintained at ActiveState.)

There’s one path shown in your output of sys.path,

C:UsersuserAppDataLocalProgramsPythonPython37-32lib

if nothing wrong, you can find the sub-directory tkinter and something like this,

 Directory of C:SoftwarePythonLibtkinter

2020/11/13  上午 04:00    <DIR>          .
2020/11/13  上午 04:00    <DIR>          ..
2017/06/17  下午 07:57             1,863 colorchooser.py
2017/06/17  下午 07:57             1,302 commondialog.py
2017/06/17  下午 07:57             1,603 constants.py
2017/06/17  下午 07:57             1,555 dialog.py
2017/06/17  下午 07:57            11,809 dnd.py
2017/06/17  下午 07:57            14,981 filedialog.py
2017/06/17  下午 07:57             6,813 font.py
2017/06/17  下午 07:57             3,835 messagebox.py
2017/06/17  下午 07:57             1,868 scrolledtext.py
2017/06/17  下午 07:57            11,847 simpledialog.py
2020/11/13  上午 04:00    <DIR>          test
2017/06/17  下午 07:57            79,034 tix.py
2017/06/17  下午 07:57            58,630 ttk.py
2017/06/17  下午 07:57           170,821 __init__.py
2017/06/17  下午 07:57               155 __main__.py
2020/11/21  下午 03:07    <DIR>          __pycache__
              14 File(s)        366,116 bytes
               4 Dir(s)  45,897,330,688 bytes free

I just installed Pycharm Community 2020.3 yesterday, not install any package from Available Packages and everything ready.

image

Posted by Marta on March 27, 2021 Viewed 65130 times

Card image cap

Hey there! This article will explain why you might encounter the error – no module named Tkinter – when you are writing a python program and how you can get around this error.

The Tkinter is a module that provides functionality to create graphical user interfaces. It will enable you to create windows, checkboxes, etc. It is a built-in module; therefore, it is included when you installed python.

So if it’s installed, why is there an error? The reason is the Tkinter module was renamed in Python version 3. In python 2, the module was initially called Tkinter. After that, in python 3, the name of the module changed to tkinter(lowercase).

Is the tkinter module installed? how to check

Firstly, let’s see how to check if the tkinter is installed with python. You can do so by running the following command from your terminal:

In case you have several python installations on your laptop, make sure you are using the correct one when running the command. For instance, in my case, I have two installations, python 2 and python3.

And when I run the command to check if tkinter is installed I see the following:

Output:

/usr/local/opt/python@2/bin/python2.7: No module named tkinter.__main__; 'tkinter' is a package and cannot be directly executed

This means that when I run the python command on my machine, I am using version 2. So if tkinter is a built-in module, why is there an error indicating it can’t find thetkinter module? The reason is the tkinter module is actually called Tkinter(uppercase) in python2.

In other words, module names in Python are case sensitive, and in the case of the tkinter module, the module name was initially named Tkinter in version 2, and changed to tkinter in Python version 3.

You can check the python version running on your machine by running the below command from your terminal:

Output:

Consequently if I run the same command but using python3, the tkinter sample window will open. See the command below:

Output:

If this window pops up, it means the tkinter module is included in your python installation.

Fix – no module named tkinter error

The easiest way to fix this problem is by upgrading your python to use python 3. If upgrading python is not an option, you only need to rename your imports to use Tkinter(uppercase) instead of tkinter(lowercase).

Check if Tkinter is available in python 2 running the following command from your terminal:

Output:

As a result, this window proves that your python installation includes the Tkinter module.

Conclusion

In conclusion, if the error no module named tkinter raises, it probably means you are using python 2. Firstly, you can get around the problem by upgrading to python 3.

Additionally, you can rename your import to Tkinter, which is how the module was named in python 2, just if upgrading is not an option.

I hope this article was useful, and thanks for reading and supporting this blog. Happy coding! 🙂

More interesting articles

python errors
django sort and filter
beautifulsoup
count occurrences in a string python

Windows 10
Python 3.7.4
OSGeo4W Shell

C:ActiveTclbin is in the PATH
tkinter folder is located in C:/OSGeo4W64/apps/Python37/lib/tkinter

python test_data_analysis.py
Traceback (most recent call last):
  File "test_data_analysis.py", line 4, in <module>
    from matplotlib import pyplot
  File "C:OSGEO4~1appsPython37libsite-packagesmatplotlibpyplot.py", line 2355, in <module>
    switch_backend(rcParams["backend"])
  File "C:OSGEO4~1appsPython37libsite-packagesmatplotlibpyplot.py", line 221, in switch_backend
    backend_mod = importlib.import_module(backend_name)
  File "C:OSGEO4~1appsPython37libimportlib__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:OSGEO4~1appsPython37libsite-packagesmatplotlibbackendsbackend_tkagg.py", line 1, in <module>
    from . import _backend_tk
  File "C:OSGEO4~1appsPython37libsite-packagesmatplotlibbackends_backend_tk.py", line 6, in <module>
    import tkinter as tk
  File "C:OSGEO4~1appsPython37libtkinter__init__.py", line 36, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter'

under py3_env I have attempted importing:

  • _tkinter
  • tkinter
  • _Tkinter
  • Tkinter

importing tk works.

Oddly enough, when I run from the Python 3.7.4 shell import tkinter works, but import tk does not.

Running python -m (all tkinter varieties) does not work.

Running python -m pip install (all tkinter varieties) does not work.

I’m on the struggle bus with this one. Any suggestions that are for Windows would be great.

Thread Rating:

  • 0 Vote(s) — 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

No module named ‘Tkinter’

Jun-30-2020, 07:57 AM
(This post was last modified: Jun-30-2020, 09:08 AM by buran.)

I’m a beginner, and from my first steps, I have a strange problem. No matter what I have done (google it, set a virtual environment, reinstalling the language several times, installing deferent versions of the language) when I’m trying to give the code:

from future.moves import Tkinter as tk
window = tk.tk()
# to rename the title of the window
window.title("GUI")
# pack is used to show the object in the window
label = tk.label(window, text = "Welcome to DataCamp's Tutorial on Tkinter!").pack()

It gives me the following error:

Error:

Traceback (most recent call last): File "D:/Applications/Python 3.7.2/Scripts/Modules-and-Functions-in-Python-Introduction-to-Tkinter-Source-code/sowtest.py", line 1, in <module> from future.moves import Tkinter as tk File "C:UsersΑλέκος Βαγιώνηςvenvpython 3.7libsite-packagesfuturemovestkinter__init__.py", line 27, in <module> from Tkinter import * ModuleNotFoundError: No module named 'Tkinter' Process finished with exit code 1

All that, after I have tried with pip in the CMD to install the module.
Though it is included with Python (as I know)
I am running a Windows 10 tablet and I have the 3.7.3 version of Python.

jdos

Programmer named Tim


Posts: 14

Threads: 4

Joined: Jun 2020

Reputation:
0

Jun-30-2020, 08:06 AM
(This post was last modified: Jun-30-2020, 08:06 AM by jdos.)

(Jun-30-2020, 07:57 AM)All_ex_Under Wrote:

from future.moves import Tkinter as tk
window = tk.tk()
# to rename the title of the window
window.title("GUI")
# pack is used to show the object in the window
label = tk.label(window, text = "Welcome to DataCamp's Tutorial on Tkinter!").pack()

Have you tried

from future.moves import tkinter as tk
window = tk.Tk()

as capitalization matters, I tried that with tkinter and works just fine (well it does load the library)
for example after you set tkinter you will get an error for your tk.tk() as it should be tk.TK() the same goes for label, it should be Label

so it should be

from future.moves import tkinter as tk
window = tk.Tk()
# to rename the title of the window
window.title("GUI")
# pack is used to show the object in the window
label = tk.Label(window, text = "Welcome to DataCamp's Tutorial on Tkinter!").pack()

Posts: 354

Threads: 13

Joined: Mar 2020

Reputation:
9

@jdos, your solution gives an excellent explanation, but the real problem is that he doesn’t have the Tkinter module installed.
To do so, just go through this link and proceed with the installation, depending upon your operating system/

Posts: 11

Threads: 4

Joined: Jun 2020

Reputation:
0

In the first time, I installed it in D drive, now besides I reinstalled my python in my C drive (during the installation some shadows were telling me that some packages won`t be installed)but IntelliJ keeps looking at D:, it still gives me an error:

Error:

"C:UsersΑλέκος Βαγιώνηςvenvpython 3.7Scriptspython.exe" "C:/Users/Αλέκος Βαγιώνης/venv/python 3.7/tesrtk.py" No Python at 'D:ApplicationsPython 3.7.2python.exe' Process finished with exit code 103

On the other side, it is still not recognizing the «Tkinter» module :

import TKinter

Telling me that the module still doesn`t exist.

Posts: 101

Threads: 5

Joined: Jul 2019

Reputation:
7

(Jun-30-2020, 01:42 PM)All_ex_Under Wrote: In the first time, I installed it in D drive, now besides I reinstalled my python in my C drive (during the installation some shadows were telling me that some packages won`t be installed)but IntelliJ keeps looking at D:, it still gives me an error:

Error:

"C:UsersΑλέκος Βαγιώνηςvenvpython 3.7Scriptspython.exe" "C:/Users/Αλέκος Βαγιώνης/venv/python 3.7/tesrtk.py" No Python at 'D:ApplicationsPython 3.7.2python.exe' Process finished with exit code 103

On the other side, it is still not recognizing the «Tkinter» module :

import TKinter

Telling me that the module still doesn`t exist.

Did you update your Python path with the latest one? And map your current Python path to the editor as well. Try running PIP command from the latest path

Posts: 98

Threads: 1

Joined: Dec 2019

Reputation:
8

You may still have other issues but as jdos mentioned you need to use «tkinter» for python 3. «Tkinter» is for python 2.

There is an example of how to detect the python version in this thread:
https://stackoverflow.com/questions/1784…nd-tkinter

«So, brave knights, if you do doubt your courage or your strength, come no further, for death awaits you all with nasty, big, pointy teeth!» — Tim the Enchanter

Posts: 5

Threads: 3

Joined: Jun 2020

Reputation:
0

Have u named your py file tkinter.py? If so u should rename it, thats how I was able to solve the problem.

Posts: 6,567

Threads: 116

Joined: Sep 2016

Reputation:
487

Jun-30-2020, 02:48 PM
(This post was last modified: Jun-30-2020, 02:48 PM by snippsat.)

No need to use future.moves and as posted you most use import tkinter for Python 3.
Not import Tkinter(Is for the dead Python 2).
you see this clearly on doc to A Simple Hello World Program.

jdos

Programmer named Tim


Posts: 14

Threads: 4

Joined: Jun 2020

Reputation:
0

Jun-30-2020, 02:48 PM
(This post was last modified: Jun-30-2020, 02:55 PM by jdos.)

First why don’t you install v3.8? Second, if you have problems with the path, uninstall all versions, reboot, install new version.

When you start the installer be sure to check the auto path install.

After that locate your python (usually C:UsersuserAppDataLocalProgramsPythonPython38-32Scripts) start cmd as administrator, cd to that folder and then run ‘pip install tkinter’ and all the other modules and libraries that you need.
Open IDLE and start coding.

And always remember, Capitalization matters. Tkinter is not tkinter for v3. ‘label’ is not ‘Label’ and tk.tk() is not tk.Tk(), that is to help you out of trouble. If you need help with the commands check TkDocs.

Cheers!

Posts: 11

Threads: 4

Joined: Jun 2020

Reputation:
0

Thank you all, Im thinking to go with Jdos suggestion, in fact Ive already solved the issue with the path through running my system as administrator.

Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem with pymodbus — ModuleNotFoundError: No module named ‘pymodbus.client.sync’ stsxbel 1 2,127 Dec-05-2022, 03:26 PM
Last Post: snippsat
  ModuleNotFoundError: No module named ‘omsdk.sdkproto’ donvito7 4 418 Oct-20-2022, 02:56 PM
Last Post: deanhystad
  [SOLVED] Tkinter module not found Milan 7 1,136 Aug-05-2022, 09:45 PM
Last Post: woooee
  ModuleNotFoundError: No module named ‘_struct’ when starting pip3 yuhuihu 0 1,321 May-05-2022, 04:41 AM
Last Post: yuhuihu
  ModuleNotFoundError: No module named ‘com’ aleksg 10 6,870 Apr-03-2022, 11:46 PM
Last Post: jocktmpltmea
  ImportError: No module named PIL rudeoil18 9 4,116 Mar-03-2022, 01:25 PM
Last Post: snippsat
  Error: «ModuleNotFoundError: No module named ‘RPi'» LucaCodes 4 2,881 Dec-29-2021, 01:58 PM
Last Post: LucaCodes
  «ModuleNotFoundError: No module named ‘PyQt5.QtWidgets’; ‘PyQt5’ is not a package» chipx 3 3,216 Dec-09-2021, 07:05 AM
Last Post: chipx
  ‘no module named’ when creating packages mbastida 4 2,389 Nov-30-2021, 10:43 AM
Last Post: Gribouillis
  No module named ‘_cffi_backend’ error with executable not with python script stephanh 2 3,406 Nov-25-2021, 06:52 AM
Last Post: stephanh

  1. the ImportError: No module named _tkinter, please install the python-tk package in Python
  2. Fix the ImportError: No module named _tkinter, please install the python-tk package in Python

Python ImportError: No Module Named _Tkinter, Please Install the Python-Tk Package

This article will discuss the ImportError: No module named _tkinter, please install the python-tk package error in Python and how to fix it.

the ImportError: No module named _tkinter, please install the python-tk package in Python

Tkinter packages must be installed externally through the CLI and imported to your program. Otherwise, you will encounter the ImportError: No module named _tkinter, please install the python-tk package.

Let’s see the example.

Code:

Output:

ImportError: No module named _tkinter, please install the python-tk package
# or
ImportError: No module named _tkinter

Fix the ImportError: No module named _tkinter, please install the python-tk package in Python

To fix the error, install the tkinter package externally from the command line interface and then import it into the current program.

There might be a different version of the command based on your operating system (OS), so you can try the one that perfectly matches your OS.

If you have Python 3x then you need to run the following command. This command also works with Ubuntu.

sudo apt-get install python3-tk

Command — Fedora:

sudo dnf install python3-tkinter

Command — Arch Linux:

sudo pacman -S tk

Command — Debian-based and Python 3x:

sudo apt-get install python-tk

Moreover, if you are using RHEL, CentOS, or Oracle Linux, then you can use yum to install tkinter.

yum install tkinter

Based on your OS, you should install the version that suits your system, then import the tkinter into your current program, and it should work fine.

Let’s try a basic GUI application with tkinter.

Code:

from tkinter import *
window=Tk()

# label
lbl=Label(window, text="Welcome to DelfStack.com", fg='blue', font=("Helvetica", 14))
lbl.place(x=60, y=100)

# title
window.title('DelfStack')

# size of the dialog box
window.geometry("400x200+10+10")

window.mainloop()

Output:

GUI application using tkinter

The above code will create a small dialog box, which in this case displays a label "Welcome to DelfStack.com" and a title "DelfStack", but you can add more weights to it accordingly.

Like this post? Please share to your friends:
  • Modulenotfounderror no module named tensorflow windows 10
  • Module qtquick is not installed windows
  • Modulenotfounderror no module named requests windows
  • Mods for minecraft windows 10 edition
  • Modulenotfounderror no module named psycopg2 windows