Simple Tkinter file dialog(open, save as, open directory, etc) http://code.activestate.com/recipes/438123-file-tkinter-dialogs/
self.create_button(mb.askyesnocancel,"Ask Yes/No/Cancel","Returns True, False or None")defcreate_button(self, dialog, title, message): command =lambda:print(dialog(title, message)) btn = tk.Button(self, text=title, command=command) btn.pack(padx=40, pady=5, expand=True, fill=tk....
dlg.protocol("WM_DELETE_WINDOW", dismiss) # intercept close button dlg.transient(root) # dialog window is related to main dlg.wait_visibility() # can't grab until window appears, so we wait dlg.grab_set() # ensure all input goes to our window dlg.wait_window() # block until window ...
from tkinter import * from tkinter import filedialog as fd import getpass as gp import os from tkinter import messagebox as mb user = gp.getuser() dct = {} #function to select initial directory based on the os def get_inidir(): if os.name == 'nt': inidir = 'shell:MyComputerFolde...
2、QInputDialog标准对话框控件 QInputDialog控件是一个标准对话框,用于获取用户输入信息,QInputDialog控件可以提供数字、字符串输入或提供下拉列表选择。 针对QInputDialog对话框控件的使用,我们主要考虑2个问题:1、如何在弹出对话框供用户输入,2、如何获取用户输入。
classtkinter.simpledialog.Dialog(parent,title=None)¶ 自定义对话框的基类. body(master)¶ 可以覆盖,用于构建对话框的界面,并返回初始焦点所在的部件。 buttonbox()¶ 加入OK 和 Cancel 按钮的默认行为. 重写自定义按钮布局. tkinter.filedialog--- 文件选择对话框.¶ ...
可以将各种不同的选项传递给这些对话框,从而允许您设置允许的文件类型,默认文件名等。 这些在getOpenFile/getSaveFile和chooseDirectory 参考手册页面中进行了详细说明。 3.2 选择颜色 还有一个模式对话框,让用户选择一种颜色。 它将返回一个颜色值,例如“#ff62b8”。 该对话框采用可选的“initialcolor”选项,以指...
parent– The Window on to which the dialog is to be placed title– The name that appears on the dialog initialdir– The directory the dialog first opens up in. initialfile– The file that the dialog has selected when it is opened. ...
tkinter.filedialog.Directory - Ask for a directory tkinter.filedialog.Open - Ask for a filename to open tkinter.filedialog.SaveAs - Ask for a filename to save as tkinter.colorchooser.Chooser - Create a dialog for the tk_chooseColor command. Other tkinter.ttk.Style - Manipulate style database...
Bug report Bug description: # Add a code block here, if required from tkinter import filedialog as FD from tkinter import * Racine = Tk() Racine.withdraw() chosen_dir = FD.askdirectory(parent=Racine) print("Chosen directory :", chosen_di...