gui_functions.py 文件源码

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

项目:WiFi_Password_Viewer 作者: jgrigg2017 项目源码 文件源码
def save_as(results_display):
    file = filedialog.asksaveasfile(
        mode='w',
        defaultextension='.txt',
        filetypes=(('Tab delimited text file', '*.txt'), ('all files', '*.*')))
    # Exit function if user presses cancel button.
    if file is None:
        return
    # Determine the order that the columns appear on the screen.
    order_map = []
    # '#all' means that the columns are in their original order and all
    # are being shown.
    if '#all' in results_display['displaycolumns']:
        order_map = list(range(len(ColumnSelect.column_names)))
    else:
        for title in results_display['displaycolumns']:
            order_map.append(ColumnSelect.column_names.index(title))

    for item in results_display.selection():
        values = results_display.item(item=item, option='values')
        for i in range(len(order_map)):
            if order_map[i] < len(values):
                file.write(values[order_map[i]])
                if i != len(order_map) - 1:
                    file.write('\t')
        if item != results_display.selection()[-1]:
            file.write('\n')
    file.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号