Very Simple Customer Queue System With Python Tkinter

Welcome to a quick tutorial on how to create a simple customer queue system with Python Flask. Want to create your own simple queue management system? Well, the basics are actually pretty simple – Read on for an example!

ⓘ I have included a zip file with all the source code at the start of this tutorial, so you don’t have to copy-paste everything… Or if you just want to dive straight in.

 

 

TABLE OF CONTENTS

Download & Notes Python Queue Useful Bits & Links
The End

 

DOWNLOAD & NOTES

Firstly, here is the download link to the example code as promised.

 

QUICK NOTES

  • Create your own project folder, e.g. D:\queue, unzip the code inside this folder.
  • Open the terminal (or command line), navigate to your project folder cd D:\queue.
  • As usual, create a virtual environment if you don’t want to mess up your other projects.
    • virtualenv venv
    • Windows – venv\scripts\activate
    • Mac/Linux – venv/bin/activate
  • Get all the packages – pip install tk
  • Launch! python queue.py
If you spot a bug, feel free to comment below. I try to answer short questions too, but it is one person versus the entire world… If you need answers urgently, please check out my list of websites to get help with programming.

 

EXAMPLE CODE DOWNLOAD

Click here to download all the example source code, I have released it under the MIT license, so feel free to build on top of it or use it in your own project.

 

 

PYTHON CUSTOMER QUEUE

All right, let us now get into the details of creating a simple python customer queue system.

 

PART 1) FOUNDATIONS

queue.py
# (A) LOAD MODULES
from tkinter import *
 
# (B) WINDOWS & COUNTERS
wNow = Tk() # window - currently serving
wIss = Tk() # window - queue number issuer
qAll = 0    # total number of people in queue
qNow = 0    # current queue number
  • (A) For the folks who have not heard of tkinter, it is one of the more popular options in Python to create a GUI.
  • (B) For this application, we are going to create 2 windows –
    • wNow “Currently serving queue number”.
    • wIss This “admin panel” issues a queue number, and shows the total number of customers.
  • (B) Next, we have 2 simple variables to keep track of the queue.
    • qAll The total number of customers.
    • qNow Currently serving this customer.

So yes, this system can be deployed using only a single device. But 2 monitors are required, one for the “admin”, and another to display the “currently serving”.

 

PART 2) MECHANICS

queue.py
# (C) MECHANICS
# (C1) ISSUE QUEUE NUMBER
def issue():
  global qAll
  qAll += 1
  wIssNum["text"] = qAll
 
# (C2) NEXT CUSTOMER
def next():
  global qAll, qNow
  if qNow < qAll:
    qNow += 1
  wNowNum["text"] = qNow

How does the queue system work?

  • (C1) The admin hits “issue queue number”, qAll += 1.
  • (C2) Then, hits the “next customer”, if qNow < qAll: qNow += 1.

As simple as “ABC”.

 

 

PART 3) USER INTERFACE

queue.py
# (D) BUILD INTERFACE
# (D1) ISSUE QUEUE NUMBER
wIssNum = Label(wIss, text="0", font=("Arial", 25))
wIssNum.pack(pady=20)
wIssIss = Button(wIss, text="Issue Queue Number", command=issue)
wIssIss.pack()
wIssNxt = Button(wIss, text="Next Customer", command=next)
wIssNxt.pack()
 
# (D2) CURRENTLY SERVING
wNowNum = Label(wNow, text="0", font=("Arial", 25))
wNowNum.pack(pady=20)

Not the prettiest interface design in the world, but it works…

 

 

PART 4) LAUNCH

queue.py
# (E) START!
wNow.mainloop()
wIss.mainloop()

Don’t think this needs explanation.

 

USEFUL BITS & LINKS

That’s all for the tutorial, and here is a small section on some extras and links that may be useful to you.

 

IMPROVEMENT IDEAS

Of course, this is only a tutorial and covers the bare basics. A lot of improvements can be made:

  • A better interface. Big numbers, funky fonts, and stuff.
  • Play a sound on “next customer”, and flash the screen.
  • Find ways to better manage the queue number… Or it will run to very big numbers eventually.
  • Maybe even save the current queue numbers in a file, so that it is not lost when the system crashes.
  • Attach a thermal printer, print, and issue a “hard copy” to the customer.
  • If there is an Internet connection, maybe even send out a reminder to the customer.

The possibilities are endless, so it’s up to you to create your own “perfect system”.

 

LINKS & REFERENCES

 

THE END

Thank you for reading, and we have come to the end. I hope that it has helped you to better understand, and if you want to share anything with this guide, please feel free to comment below. Good luck and happy coding!

Leave a Comment

Your email address will not be published.