Where to get tkinter
And since you are on Windows, I believe you installed Python through the binaries on their website? If you are using virtualenv, it is fine to install tkinter using sudo apt-get install python-tk python2 , sudo apt-get install python3-tk python3 , and and it will work fine in the virtual environment.
Tkinter and, since Python 3. It is important that you use a version of Python supporting Tk 8. We recommend installing the "ActivePython" distribution from ActiveState, which includes everything you'll need. In your web browser, go to Activestate.
Make sure you're downloading a 3. Run the installer, and follow along. You'll end up with a fresh install of ActivePython, located in, e. From a Windows command prompt, or the Start Menu's "Run If it is installing with a cross at the left then Tkinter will not be installed.
When you install python for Windows, use the standard option or install everything it asks. I got the error because I deselected tcl. I came here looking for an answer to this same question and none of the answers above actually answer the question at all! Personally I find this very annoying as i'm packaging a python application to be installed via pip that uses tkinter and I was looking for a way to have pip ensure that tkinter is installed and the answer is I can't I have to instruct users to install it if it's not installed already, a very poor experience for end users who should not need to know or care what tkinter is to use my application.
The solution is to repair the installation via uninstall GUI is fine , and select to install tk this time. You may need to point at or redownload the binary in this process.
Downloading directly from activestate did not work for me. When you run this, DDL should be installed like so:. I had the similar problem with Win-8 and python The import tkinter should work.. Button you just type Button. Stack Overflow for Teams — Collaborate and share knowledge with a private group.
This will act as the window for our application. Once the application is ready we can start it enter the main event loop with the mainloop method. This will open and run the application until it is stopped by the window being closed or calling exiting functions from callbacks discussed later such as root.
Note: It's possible to inherit from just about any tkinter widget, including the root window. Inheriting from tkinter. Frame is at least arguably the most flexible in that it supports multiple document interfaces MDI , single document interfaces SDI , single page applications, and multiple-page applications. To verify if you have successfully installed Tkinter, open your Python console and type the following command:.
Reinforcement Learning. R Programming. React Native. Python Design Patterns. Python Pillow. Python Turtle. Verbal Ability. Interview Questions. Company Questions. Artificial Intelligence. Cloud Computing. Data Science. The easiest way to download Tkinter is therefore to install a recent version of Python. Older versions of Tkinter do not include the latest widgets provided by the Ttk extension.
The best Tkinter download version is 8. For Python developers, the easiest way to get the latest version of Tkinter is to install Python 3. What is Tkinter used for and how to install it? How to Use Tkinter In the following example, Tkinter creates a Tk application frame and a button widget that exits the application when clicked.
Related Links. Frequently Asked Questions.
0コメント