WebNov 29, 2024 · This function comes under the class filedialog. Below is the Code: from tkinter import * from tkinter import ttk from tkinter.filedialog import asksaveasfile root = Tk () root.geometry ('200x150') def save (): files = [ ('All Files', '*.*'), ('Python Files', '*.py'), ('Text Document', '*.txt')] WebMar 7, 2024 · 以下是 Python Tkinter 模块创建窗口的代码: ```python import tkinter as tk from tkinter import filedialog def save_file (): file_path = filedialog.asksaveasfilename (defaultextension=".txt") with open (file_path, "w") as file: file.write (text_box.get ("1.0", "end")) root = tk.Tk () root.title ("窗口") label = tk.Label (root, text="标签") label.pack () text_box = …
path - Python created folder with \ instead of / - Stack Overflow
WebJun 28, 2024 · filedialogを使ってみよう. tkinter.filedialog モジュールを使うと、ファイルまたはディレクトリーを選択するための簡単なダイアログを作成することができます。 今回は filedialog の具体的な使い方をみていきましょう。. filedialogのインポート. filedialogのメソッドを使うには、tkinter.filedialogを ... Web2 days ago · The tkinter.filedialog module provides classes and factory functions for creating file/directory selection windows. Native Load/Save Dialogs¶ The following … Source code: Lib/tkinter/messagebox.py The tkinter.messagebox module provides … オペ看 勉強 本
def get_directory(): directory = filedialog.askdirectory() return ...
WebMar 6, 2024 · 可以使用Python自带的tkinter库来实现GUI界面,具体代码如下: ```python import tkinter as tk from tkinter import filedialog root = tk.Tk() root.withdraw() # 弹出选择文件夹对话框 folder_path = filedialog.askdirectory() # 打印选择的文件夹路径 print("选择的文件夹路径为:", folder_path) ``` 这段 ... Webtkinter.filedialog 모듈은 파일/디렉터리 선택 창을 만들기위한 클래스와 팩토리 함수를 제공합니다. 네이티브 로드/저장 대화 상자 ¶ 다음 클래스와 함수는 네이티브 모양과 느낌을 동작을 사용자 정의하는 구성 옵션과 결합하는 파일 대화 상자 창을 제공합니다. 다음 키워드 인자는 아래 나열된 클래스와 함수에 적용할 수 있습니다: parent - 대화 상자를 그 위에 놓을 … オペ看 結婚