首页 > 解决方案 > Tkinter filedialog.askdirectory() 在 Windows 服务器中不起作用

问题描述

我正在使用 Tkinter 打开一个询问路径的对话框,用于此的代码是

from tkinter import filedialog
from tkinter import *

root = Tk()
root.withdraw() #Since I only need the filedialog and not a blank window at the back
source_folder = filedialog.askdirectory(title = 'Select Source Folder')

这适用于我的 Windows 安装,但是当我在 Windows 服务器上运行它时,对话框(文件夹选择框未打开)

注意Windows 服务器不会冻结,它只是不显示弹出窗口,并且 powershell 的行为就像它正在等待输入一样。

系统配置:

本地系统(工作):Python 3.6,Windows 10 N (1803)

远程系统(不工作):Python 3.6、windows Server 2016 Standard (1607)

使用 连接到远程服务器mstsc,如果需要,我很乐意提供其他信息。

我在发布之前已经尝试过的事情:

让我知道您是否能够复制问题,如果不能,我可能必须重置 Windows 服务器安装。PS 以防万一,是的,服务器具有完整的图形界面,而不是命令行界面。

标签: pythonpython-3.xtkinter

解决方案


推荐阅读