当前位置:   article > 正文

Python--tkinter之filedialog_python filedialog.askdirectory

python filedialog.askdirectory

tkinter.filedialog 的学习

tkinter.filedialog.asksaveasfilename():选择以什么文件名保存,返回文件名

def selectinputPath():
    input_path = asksaveasfilename()
    inputpath1 = inputpath.set(input_path)
    print(input_path)
  • 1
  • 2
  • 3
  • 4

显示如下:
在这里插入图片描述
在这里插入图片描述

tkinter.filedialog.askopenfilename():选择打开什么文件,返回文件的绝对路径

def selectinputPath():
    input_path = askopenfilename()
    inputpath1 = inputpath.set(input_path)
    print(input_path)
  • 1
  • 2
  • 3
  • 4

显示如下:
在这里插入图片描述

tkinter.filedialog.askdirectory():选择目录,返回目录名

def selectinputPath():
    input_path = askdirectory()
    inputpath1 = inputpath.set(input_path)
    print(input_path)
  • 1
  • 2
  • 3
  • 4

显示如下:
在这里插入图片描述

代码如下:

from tkinter import *
import tkinter.messagebox as messagebox
from tkinter.filedialog import *
import time
import os
import shutil


currentTime = time.strftime('%Y%m%d')  #定义时间

def save_Filename():
    saveas_filename = asksaveasfilename()
    save_filename1 = save_filename.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/677166
推荐阅读
相关标签
  

闽ICP备14008679号