I get a strange window when I use the open directory dialog in Tkinter

Windows7态python2.7.8

import Tkinter
import tkFileDialog 

dir = tkFileDialog.askdirectory()

When I want to see it, a blank window with the title "Tk" comes out meaninglessly. This window does not disappear even after selecting a folder The worst falls. It doesn't seem to happen on linux.

The following seems to be a workaround.

import Tkinter
import tkFileDialog 

root = Tkinter.Tk()
root.withdraw()
dir = tkFileDialog.askdirectory()
root.destroy()

Recommended Posts

I get a strange window when I use the open directory dialog in Tkinter
When I get a chromedriver error in Selenium
In the Chainer tutorial, I get an error when importing a package. (mock)
I get a java.util.regex.PatternSyntaxException when splitting a string in PySpark
I get a KeyError in pyclustering.xmeans
I get a can't set attribute when using @property in python
When you make a mistake in the directory where you execute `pipenv install`
I can't get the element in Selenium!
I get an error when I put a Python plugin in Visual Studio Code under the pyenv environment
Get the filename of a directory (glob)
When I name the file flask.py in Flask, I get Import Error: cannot import name'Flask'
How to display in the entire window when setting the background image with tkinter
How to get a list of files in the same directory with python
[Python] Get the files in a folder with Python
Use the latest pip in a virtualenv environment
Get the caller of a function in Python
I want to create a window in Python
Get only the subclass elements in a list
Get the X Window System window title in Python
I get a UnicodeDecodeError when running with mod_wsgi
[Question] What happens when I use% in python?
Use pygogo to get the log in json.
As a beginner, I searched the / proc directory
A template that I often use when making Discord BOT in Python (memorial note)
I want to use a python data source in Re: Dash to get query results
Get the file name in a folder using glob
I made a window for Log output with Tkinter
I get an error when I put opencv in pyautoGUI
Use communicate () when receiving output in a Python subprocess
Let's use the open data of "Mamebus" in Python
I want to use the R dataset in python
I can't use the darknet command in Google Colaboratory!
I made a class to get the analysis result by MeCab in ndarray with python
A story that went missing when I specified a path starting with a tilde (~) in python open
I tried to create a Python script to get the value of a cell in Microsoft Excel
[Python] When you want to import and use your own package in the upper directory
The story I was addicted to when I specified nil as a function argument in Go
I made a simple typing game with tkinter in Python
I was in trouble because the character string in the PDF was strange
I tried the super-resolution algorithm "PULSE" in a Windows environment
Add "/" at the end when completing a directory symbolic link
How to use the __call__ method in a Python class
Opens in a new window when launching Jupyter Notebook (Windows)
I tried "How to get a method decorated in Python"
[Note] Import of a file in the parent directory in Python
How to get the last (last) value in a list in Python
I wrote a script to get a popular site in Japan
I made a puzzle game (like) with Tkinter in Python
I tried to make a stopwatch using tkinter in python
A note when I can't open Jupyter Notebook on Windows
Automatically opens in a new window when launching Jupyter Notebook
I wrote a script that splits the image in two
When I try to run the pip command after updating pip, I get "No such file or directory"
A story that didn't work when I tried to log in with the Python requests module
About the error I encountered when trying to use Adafruit_DHT from Python on a Raspberry Pi
When I cut the directory for UNIX Socket under / var / run with systemd, I got stuck in a pitfall and what to do