Python之paramiko、tkinter实现远程数据备份的桌面程序

本文介绍如何结合Python的paramiko库和tkinter GUI,创建一个桌面应用程序,实现远程服务器的数据备份功能。通过paramiko库进行SSH连接,执行远程命令进行数据复制,tkinter则提供友好的用户交互界面。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

# @Author: Lee
# @Filename: SynchronizeFile
# @Date: 2020-07-29-11-37
# @E-MAIL: 654994961@qq.com
# __author__ == 'ljh'
from tkinter import *
# 制作GUI界面
import paramiko
# 用来远程
import time
from tqdm import tqdm
# 用来显示进程
import os


class Application(Frame):
    def __init__(self, master):
        super(Application, self).__init__(master)
        # 继承超类/父类的初始化

        Label(self, text='Remote Data Dir').grid(row=0, column=0, sticky=W, padx=0, pady=0)
        default_remote_dir = StringVar()
        # 字符变量
        default_remote_dir.set(r'/备站备份/')
        self.remote_dir_ent = Entry(self, textvariable=default_remote_dir, width=52)
        # width值是自己摸索的 grid()来布局需要自己重复的实验,以求找到最合适的大小
        self.remote_dir_ent.grid(row=0, column=1, columnspan=3, sticky=W, padx=0, pady=0)

        Label(self, text='Local Data Dir').grid(row=1, column=0, sticky=W, padx=0, pady=0)
        default_local_dir = StringVar()
        default_local_dir.set(r'D:\ljh\untitled\sdv')
        self.local_dir_ent = Entry(self, textvariable=default_local_dir, width=52)
        self.local_dir_ent.grid(row=1, column=1, columnspan=3, sticky=W, padx=0, pady=0)

        Label(self, text='
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值