Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7632671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:41:05+00:00 2026-05-31T06:41:05+00:00

I am writing an app in python using tkinter. In this app I am

  • 0

I am writing an app in python using tkinter. In this app I am trying to send out a batch of emails and I want to show a progress bar while they are being sent. I am able to create the progress bar and start it, but when the emails are being sent, the bar just stops moving (If it is started way before the emails are sent, I want to start the bar just before the emails are sent, but it just hangs and nothing moves on the bar when I do it like this.

startProgressBar()
sendEmails()
stopProgressBar()

I have tried putting the sending of emails into a separate thread, but I don’t seem to be having any luck. I am using the high-level Threading module. Are there any suggestions on what to do? Perhaps I am not getting the threading part correct. I am using the smtplib to send emails.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:41:07+00:00Added an answer on May 31, 2026 at 6:41 am

    This is an old question but the code recipe I’m referring to has helped me with a similar concept, so I thought it should be shared.

    This type of problem needs to use threading so that we spilt up the job of updating the GUI and doing the actual task (such as sending emails). Have a look at this code recipe from Active State, I believe it’s exactly what you’re looking for as an example of threading and passing information between threads (via a queue).

    I try to highlight the important parts from the code recipe. I don’t include setting up the progress bar itself but rather the overall code structure and getting/setting a queue.

    import Tkinter
    import threading
    import Queue
    
    class GuiPart:
        def __init__(self, master, queue, endCommand):
            self.queue = queue
            # Do GUI set up here (i.e. draw progress bar)
    
            # This guy handles the queue contents
            def  processIncoming(self):
                while self.queue.qsize():
                    try:
                        # Get a value (email progress) from the queue 
                        progress = self.queue.get(0)
                        # Update the progress bar here.
    
                    except Queue.Empty:
                        pass
    
    class ThreadedClient:
        # Launches the Gui and does the sending email task
        def __init__(self, master):
            self.master = master
            self.queue = Queue.Queue()
    
            # Set up the Gui, refer to code recipe
            self.gui = GuiPart(master, self.queue, ...)
    
            # Set up asynch thread (set flag to tell us we're running)
            self.running = 1        
            self.email_thread = threading.Thread(target = self.send_emails)
            self.email_thread.start()
    
            # Start checking the queue
            self.periodicCall()
    
         def periodicCall(self):
             # Checks contents of queue
             self.gui.processIncoming()
             # Wait X milliseconds, call this again... (see code recipe)
    
         def send_emails(self): # AKA "worker thread"
             while (self.running):
                 # Send an email
                 # Calculate the %age of email progress
    
                 # Put this value in the queue!
                 self.queue.put(value)
    
         # Eventually run out of emails to send.
         def endApplication(self):
             self.running = 0
    
    
    root = Tkinter.Tk()
    client = ThreadedClient(root)
    root.mainloop()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a web app using python with web.py, and I want to implement
I'm using libxml2 in a Python app I'm writing, and am trying to run
I'm writing a simple app with AppEngine, using Python. After a successful insert by
I am writing an app using python on GAE. I figure since I'm using
I'm writing a web-app using Python and Pylons. I need a textbox that is
I'm currently writing a small python app that embeds cherrypy and django using py2app.
I'm writing a GAE app in Java and only using Python for the data
I am writing an app in python using getk and I've come across a
(I'm using Python 2.6 and nose .) I'm writing tests for my Python app.
i am writing an app to compare products, using Python and GAE. The products

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.