Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for Ftp client with GUI Python🐱‍🏍
Uki
Uki

Posted on

     

Ftp client with GUI Python🐱‍🏍

Ok let's dive in to the project. and this is my first post hear so you know what I'm talking about. Main libraries I use are the FTPlib and customtinter for the GUI.

Source code :

GitHub logo ukihunter / Python-FTP-Client

A simple and efficient FTP client built with Python, allowing users to connect to FTP servers, upload/download files, and manage directories seamlessly.


🌐🚀 Python FTP Client

Apowerful yet simple FTP client built with Python, allowing seamless file transfers between local and remote servers. Perfect for managing FTP connections with ease!

forest

🎯 Key Features

✔️Connect to any FTP server securely
📂Upload & Download files effortlessly
📁Manage Directories (list, rename, delete)
🔄Transfer Status Updates in real-time
🔒Secure & User-Friendly

🔧 Installation

1️⃣Clone the Repository

git clone https://github.com/Ukihanter/Python-FTP-Client/tree/maincd your-repo-name
Enter fullscreen modeExit fullscreen mode

2️⃣Install Dependencies

pip install -r requirements.txt
Enter fullscreen modeExit fullscreen mode

🚀 How to Use

⚡ Run the FTP Client:

python gui.py
Enter fullscreen modeExit fullscreen mode

💡 Enter FTP server details and start transferring files easily!

📦 Requirements

🔹 Python 3.x
🔹ftplib (Built-in)
🔹 Any additional dependencies inrequirements.txt
🔹 Defult local path is set to D:\ Feel free to edit it.

📜 License

📄 Open-source under theMIT License – Feel free to contribute!

🔗Contribute & Star ⭐ the project if you find


Making the GUI
  • First i created the GUI using Figma.and i used a tool called Tkinter-Designer to import them to the python Gui it is a very easy way to make python GUI but it has some downfalls.

  • Tkinter-Designer :https://github.com/ParthJadhav/Tkinter-Designer

  • Video Tutorial :https://www.youtube.com/watch?v=oLxFqpUbaAE&t=562s

  • Documentation :https://github.com/ParthJadhav/TkinterDesigner/blob/master/docs/instructions.md

  • After creating the GUI you can go to the next step 🤓

Cording

Requirements :

# This project uses Python's standard libraries only.# No additional packages need to be installed.# Optional: Specify Python version if needed# python_version >= 3.9
Enter fullscreen modeExit fullscreen mode

Now we have to import the libraries that we used for this project.

import os                  # For operating system/file handlingfrom pathlib import Path   # For path manipulationfrom ftplib import FTP     # For FTP protocol operationsimport datetime            # For timestamp handlingfrom tkinter import ttk, messagebox     # GUI componentsimport tkinter as tkfrom tkinter import Tk, Canvas, Entry, Text, Button, PhotoImage
Enter fullscreen modeExit fullscreen mode

These are the Generated by the Tkinter-Designer and you don't have to worry about that

# Set up paths for GUI assetsOUTPUT_PATH = Path(__file__).parentASSETS_PATH = OUTPUT_PATH / Path(r"C:\Users\GIGABYTE\Desktop\New folder (4)\build\build\assets\frame0")def relative_to_assets(path: str) -> Path:    """Helper function to create absolute paths for GUI assets"""    return ASSETS_PATH / Path(path)
Enter fullscreen modeExit fullscreen mode

Basic GUI model

# Create main application windowwindow = Tk()window.title("FTP client By uki")window.geometry("1280x720")window.configure(bg="#2B2B2B")  # Dark background color
Enter fullscreen modeExit fullscreen mode

Defining the Default file path to the client

# Global variables for FTP connection and navigationftp = None  # Will hold the FTP connection objectcurrent_ftp_path = "/"  # Current directory on FTP servercurrent_local_path = "D:/"  # Current directory on local machine
Enter fullscreen modeExit fullscreen mode

issue : I used the default"D:/" because if you put this in to
C:/ it will return with access denied error.

Now we going to received the files from the local machine in hear i used the Tree view to show case the files it also usetry function to update the file list .in the end as you can see it has Error handling and toPermission Error andException

File receiving

This part in the code handle the navigation in the local machine decretory using Double click function.

Navigation in local machine

Nowlocal_go_back function handle the back navigation in the local machine directory.
GO back function

Now it take the inputhostusernamepassword and it usetry function to establish the connection to the server. if the connection successful it return the log as✅ Connected successfully! if not it return theException Error
Stablish the connection to server

Now List down the Host files as same as local machine and also error handling

List down the Host files

Handling the file navigation in the Host :
navigation in the Host

Host and local file Tree view stretcher :
local file

Host file

loading the decretory when loading(in this case it DriveD:/)

Image description

Button stretcher and function calling :

Connecting button

This Button is the tiger that to connect to the ftp servercommand=connect_to_ftp, other variables are the design and the position of the button

Delete Button
Delete Button

This Button is the tiger that to delete selected file from the ftp servercommand=delete_file, other variables are the design and the position of the button

Upload Button
Upload Button

This Button is the tiger that to Upload selected file from the local clientcommand=upload_file, other variables are the design and the position of the button

Download Button
Download Button

This Button is the tiger that to Download selected file from the Host Servercommand=download_file, other variables are the design and the position of the button

Main function in the Ftp client

Download function
Download function

when thedownload_file function tiger it check the connection and try to dowanlad the selcted file from the host if not it return error massages usingmessagebox if all good it save the file to the local path.

Upload function
Upload function

This function also have the same procedure except it upload file to the host and also provide necessary error massages.

Deleting function
Deleting function

Function that delete file from the host this can't be perform in the local machine.

Path verification

Upload log
Upload path
logging the uploading success This Enter the text to entry_4

*Download log *
Download path
logging the Downloading success. This Enter the text to entry_4

Ok now you know how it happened. I know this can be a real boring one for you .maybe not.However this is my first article you can wish me luck 😉

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

  • Joined

More fromUki

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp