Skip to content

Codealong mini-project turned into a sandbox for Python + MySQL + TKinter practice from the video "PYTHON MASTERCLASS - Aprende a manejar MySQL con Python" by Programación Fácil

Notifications You must be signed in to change notification settings

alejandro-arriola/progr_facil-python_mysql_gui

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Practice Mini-Project: "PYTHON MASTERCLASS - Aprende a manejar MySQL con Python"

Overview

Code-along project turned into a sandbox to practice Python + MySQL + TKinter. The original project was done in the video: "PYTHON MASTERCLASS - Aprende a manejar MySQL con Python" by Enrigue Barros Fernández (Programación Fácil). Because I turned it into a sandbox for practice, my code here is not a 1:1 copy of the code done in the video.

The app is about storing image URLs with a name, with the option to see the image and make a backup of the database.

  • It starts with a "Login" window with the correct user and password already put so to log-in directly. The login is not meant to be serious, so it is not following patterns for secure login.
  • Main window with four buttons to access the rest of the app.
    • crud: Opens a windows for basic register-delete-update for the image URLs
    • Ver registros: it calls a SELECT SQL command to see all entries of the table storing the image URLs.
    • Ver imagen: a window to fetch and see the image by ID. In theory, if the URL passed is not a valid URL, it will attempt to open it as a local image.
    • Respaldar base de datos: it creates a backup for the database inside the folder bd/respaldos/.

For the GUI it uses TKinter, CustomTKinter and CTkMessagebox (for the messageboxen)

Structure

image

Notes:

  • Git did not push the folders respaldos and imagenes for some reason
  • the init.py files are empty, but they were created in the video and never given an explicit use
  • base_datos.py contains the class with the methods to deal with databases. This is the one used in this video, but I did not implemented everything from the video (only what I found interesting trying) and some code differs
  • muh_database.py is a custom DB class for my own use of this project, since base_datos.py does not hold the methods required and the method for general SQL query was not working properly to me
  • tablas.py contains data to create a table with base_datos.py
  • imagenes folder is meant to contain logo.ico and logo.rng for the GUI
  • interfaz_grafica.py deals with the GUI

Screenshots

Login Main
CRUD Ver registros
Ver imagen

How to Run

  • Install these if you have not already...

    • MySQL connector: pip install mysql-connector-python
    • PIL: pip install Pillow
    • CustomTKinter: pip install customtkinter
    • CTkMessagebox: pip install ctkmessagebox

    If you are having trouble with these commands, you might run them by adding python -m or python3 -m at the beginning of the command.

  • In MySQL: create a DB with a single table. The attributes (columns) required can be found in the file bd/tablas.py

  • In base_datos.py in the acceso_bd dictionary and muh_database.py under its constructor put all the SQL related data (like user and password) required to interact with your DB

  • Clone this repo and add a logo.ico and logo.png if you wish inside interfaz/imagenes/.

  • Open the repo in VS Code and run app.py

Notes

  • The app has some basic checks so it does not die that easily
  • For some reason, the icon "error" from the CTkMessagebox was resulting in a glitch with CTkMessagebox vomiting all over itself, so I changed to "warning"

About

Codealong mini-project turned into a sandbox for Python + MySQL + TKinter practice from the video "PYTHON MASTERCLASS - Aprende a manejar MySQL con Python" by Programación Fácil

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages