TSEBIPythonInterface.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:pyTSEB 作者: hectornieto 项目源码 文件源码
def _setup_tkinter(self):
        '''Creates a Tkinter input file dialog'''

        # Import Tkinter GUI widgets
        if sys.version_info.major == 2:
            from tkFileDialog import askopenfilename, asksaveasfilename
            import Tkinter as tk
        else:
            from tkinter.filedialog import askopenfilename, asksaveasfilename
            import tkinter as tk

        # Code below is to make sure the file dialog appears above the
        # terminal/browser
        # Based on
        # http://stackoverflow.com/questions/3375227/how-to-give-tkinter-file-dialog-focus

        # Make a top-level instance and hide since it is ugly and big.
        root = tk.Tk()
        root.withdraw()

        # Make it almost invisible - no decorations, 0 size, top left corner.
        root.overrideredirect(True)
        root.geometry('0x0+0+0')

        # Show window again and lift it to top so it can get focus,
        # otherwise dialogs will end up behind the terminal.
        root.deiconify()
        root.lift()
        root.focus_force()

        return root, askopenfilename, asksaveasfilename
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号