Code Monkey home page Code Monkey logo

grocery-shop's Introduction

Tkinter Grocery Application

This is a simple Tkinter application that demonstrates how to create a table using the ttk.Treeview widget with scroll bars for displaying production information. The application includes a basic structure with headings and scrollable rows.

Getting Started

Ensure you have Python installed on your system. You can download it from python.org.

Prerequisites

This application uses the tkinter library, which is included in the Python standard library. No additional dependencies are required.

Installation

Clone this repository to your local machine:

[email protected]:ebarthur/tkinter-grocery-app.git

Navigate to the project directory:

cd tkinter-grocery-app

Run the application:

python main.py

Setting Up the Database

  1. Install PostgreSQL: Make sure you have PostgreSQL installed on your machine. You can download it from PostgreSQL Downloads.

  2. Create a Database: Open pgAdmin or any PostgreSQL management tool and create a new database named grocery_store. You can use the following SQL command in pgAdmin:

    CREATE DATABASE grocery_store;
  3. Create a Table: After creating the database, execute the following SQL command to create an inventory table within the grocery_store database:

    CREATE TABLE inventory (
     product_id VARCHAR(10),
     product_name VARCHAR(255),
     category VARCHAR(50),
     brand VARCHAR(50),
     price VARCHAR(10),
     stock_quantity INTEGER,
     supplier VARCHAR(255),
     expiry_date DATE,
     discount VARCHAR(10),
     location VARCHAR(50));
  4. Insert Sample Data: Optionally, you can insert sample data into the inventory table:

    INSERT INTO inventory VALUES
    ('101', 'Banana', 'Fruits', 'Chiquita', '$0.79', 100, 'Local Farms', '2023-01-10', '5%', 'Aisle 1'),
    -- Add more rows as needed
    **UPDATE inventory
    SET stock_quantity = 100
    WHERE product_id = '114'::character varying;
    

    Please note that the date format should be 'YYYY-MM-DD'.

  5. Update Python Script: Open the main.py script and update the PostgreSQL connection details:

    # Connect to PostgreSQL
    connection = psycopg2.connect(
        host="localhost",
        database="grocery_store",
        user="your_postgres_user",
        password="your_postgres_password"
    )

    Replace your_postgres_user and your_postgres_password with your PostgreSQL username and password.

Usage

  • The application window will open, displaying a table with sample data.
  • Customize the populate_table method in main.py to fetch data from your database using the appropriate method (replace the mock data with actual data).

Structure

  • main.py: Contains the main application code, including the GroceryStore class that sets up the Tkinter window and the table.
  • commands.py (not provided): Add your database-related commands and functions here.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

grocery-shop's People

Contributors

ebarthur avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.