Real Time Barcode Scanner With Python & Tkinter

(7 customer reviews)

Original price was: ₹899.00.Current price is: ₹45.00.

+ Free Shipping

The provided Python script is a Tkinter-based Barcode Scanner application utilizing OpenCV for video capture and PyZbar for barcode decoding. The application continuously scans for barcodes through the computer’s webcam, displays the video feed in a Tkinter window, and reacts to detected barcodes by playing a sound, saving data, and updating the display.

Indian rupee (₹) - INR
  • Indian rupee (₹) - INR
  • United States dollar ($) - USD
  • Russian ruble (₽) - RUB

Libraries Used:

  1. tkinter (tk):
    • Used for creating the graphical user interface (GUI).
  2. ttk:
    • A themed Tkinter module used for styling buttons in the GUI.
  3. PIL (Pillow):
    • Used for handling images, converting frames from OpenCV to Tkinter-compatible format.
  4. cv2 (OpenCV):
    • Used for video capture, image processing, and barcode detection.
  5. pyzbar:
    • A Python library for reading barcodes using the OpenCV library.
  6. threading:
    • Utilized for running barcode scanning in a separate thread to avoid blocking the main thread and allow for a responsive GUI.
  7. time:
    • Used for introducing a delay to avoid multiple entries for a single barcode scan.
  8. pygame:
    • Utilized for playing a sound when a barcode is detected.
  9. os:
    • Used to obtain the absolute path for the sound file.
  10. datetime:
    • Used for timestamping the saved barcode data.

Application Features:

  1. GUI Initialization:
    • The application initializes a Tkinter window with a specified size and title.
  2. Styling Configuration:
    • The ttk module is used to configure styles for buttons and labels, enhancing the appearance of the UI.
  3. Video Feed Display:
    • The application creates a Tkinter Label to display the video stream captured from the webcam.
  4. Barcode Scanning Thread:
    • The barcode scanning is performed in a separate thread (barcode_scanner method) to ensure a responsive GUI.
  5. Stop Scanning Button:
    • A “Stop Scanning” button is created using ttk.Button. Clicking this button stops the barcode scanning and closes the application window.
  6. Barcode Scanning Process:
    • The application captures the webcam feed and detects barcodes using OpenCV and PyZbar.
    • Detected barcodes are displayed on the video feed and added to a set (scanned_barcodes) to avoid duplicate entries.
    • When a new barcode is detected, a sound is played using pygame.
  7. Display Update:
    • The video feed is continuously displayed in the Tkinter window using PIL to convert OpenCV frames to Tkinter-compatible format.
  8. Data Saving:
    • Scanned barcode data, along with timestamps, is saved to a text file (scanned_data.txt).
  9. Application Exit:
    • The application window is closed gracefully upon stopping barcode scanning.


  • Run the script, and the Tkinter window will open with the webcam feed.
  • The application scans for barcodes continuously.
  • Click the “Stop Scanning” button to halt barcode scanning and close the application.
  • Scanned barcode data is saved to a text file with timestamps.


  • Ensure that the required libraries are installed (tkinter, opencv-python, pillow, pyzbar, pygame).
  • A sound file (beep.wav) is expected to be in the same directory as the script.
  • The application will create or append to the file scanned_data.txt in the script’s directory.

7 reviews for Real Time Barcode Scanner With Python & Tkinter

There are no reviews yet.

Be the first to review “Real Time Barcode Scanner With Python & Tkinter”

Your email address will not be published. Required fields are marked *

Shopping Basket