6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Tkinter でオープンディレクトリダイアログを使うとへんなウィンドウが出る

Posted at

Windows7、python2.7.8

import Tkinter
import tkFileDialog 

dir = tkFileDialog.askdirectory()

見たいな事すると、タイトルが「Tk」となるblankウィンドウが意味もなく出てくる。
フォルダを選択し終わってもこのウィンドウは消えず、
最悪落ちる。
linuxだと起こらないらしい。

以下が回避策らしい。

import Tkinter
import tkFileDialog 

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

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?