简体   繁体   中英

Tkinter not importing on windows

I'm creating a GUI using tkinter but have no experience using it in windows. I followed this documentation: http://www.tkdocs.com/tutorial/install.html My program folder is connected to a virtual environment that has python3.6 downloaded into it. I have installed ActiveTcl, ran the test, and it showed I had the correct version of tkinter installed.

in the beginning of the program I have "import tkinter", to which the IDE responds with "unable to resolve "tkinter", IntelliSense may be missing for this module"

I noticed that when I installed activetcl, it created a "tcl" folder outside of my "site-packages" folder(the folder I get all other imports from). The tcl folder holds all of the tkinter libraries but if I "import tcl", it still doesn't work.

Any ideas as to why this could be?

I've been told to just try this

try:
    # for Python2
    from Tkinter import *
except ImportError:
    # for Python3
    from tkinter import *

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM