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 6343105
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:22:15+00:00 2026-05-24T20:22:15+00:00

Possible Duplicate: How can I monitor Tkinter buttons when Python is busy? I have

  • 0

Possible Duplicate:
How can I monitor Tkinter buttons when Python is busy?

I have a problem with tkinter gui code i wrote.It stops responding when i press a button and the function is executed.Here is an example code to make things clearer:

from Tkinter import*
import Tkinter as tk
import tkFileDialog
import urllib
import urllib2


list1 =["urls of video files"]


def run():
    for links1 in list1:
    text1.insert(str(list1.index(links1)+1)+'.end', 'video_'+str(list1.index(links1)+1)+'.mp4'+'.........Downloading')
        text1.update()#Update text widget
        urllib.urlretrieve(links1.split('\">')[0],'video_'+str(list1.index(links1)+1)+'.mp4')
        text1.insert(str(list1.index(links1)+1)+'.end','.....Finished\n')
        text1.yview(END)
    text1.insert(END,'>>All files have been downloaded.Enjoy ! ! !\n')


#Window Title    
app=Tk()
app.title("Title")
app.geometry('700x400+200+200')
app.resizable(0,0)



button=Button(app,text="Press me",font=("Times", 12, "bold"),width=20,borderwidth=5,command=run)
button.pack(padx=5,pady=8)


frame1 = Frame(app, width=600, height=200)
xframe1 = Frame(frame1, relief=RAISED, borderwidth=5)


text1 = Text(frame1,height = 3,font=("Times", 12))
text1.insert(END,"")
text1.pack(side=LEFT,fill=Y)


s_start = Scrollbar(frame1)
s_start.pack(side=RIGHT,fill=Y)
s_start.config(command=text1.yview)
text1 .config(yscrollcommand=s_start.set)

Label(frame1, text='').place(relx=1.06, rely=0.125,anchor=CENTER)
frame1.pack()

app.mainloop()
  • 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-24T20:22:16+00:00Added an answer on May 24, 2026 at 8:22 pm

    This question is a duplicate, so look at the answers for the original. Short answer: the window needs the event loop to be running so that redraw events can be processed, but while your loop is running the event loop is stopped.

    To answer the question in the comments:

    the event loop is an infinite loop that runs when you call mainloop. It looks something like this:

    while True:
        event = event_queue.pop()
        event.process()
    

    (there isn’t really a global object literally named event_queue, so don’t go looking for it…)

    When run is running, it is being run inside the imaginary event.process() method. When you update a widget from code such as inserting text, the widget is not immediately redrawn. Instead, a “redraw” event is added to the queue. However, while your run function is running, you are stuck in the event.process() portion of the event loop and thus no other events are being processed. Thus, no redrawing of the screen can happen until your function exits and the next event is pulled off the queue.

    Now, if you run update in your function, it starts a new event loop and those events will be processed. This can be bad because you have a potentially infinite loop inside an infinite loop. If you call update_idletasks, however, it causes only the “idle” tasks to be processed. Redraw events fall into this category so they are processed, but things like button clicks and mouse movements are not processed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Can someone Explain this jQuery code? I have posted this before, but
Possible Duplicate: Can Read-Only Properties be Implemented in Pure JavaScript? I have an Object
Possible Duplicate: Clipboard event C# Hi, Can I monitor the clipboard continuously for any
Possible Duplicate: Can distribute setuptools be used to port packages implemented in python 2
Possible Duplicate: Can you write object oriented code in C? I'm wondering if it's
Possible Duplicate: Can you write object oriented code in C? Hi, can someone point
Possible Duplicate: Can I set a breakpoint on 'memory access' in GDB? I have
Possible Duplicate: Can't pass mysqli connection in session in php Many of us have
Possible Duplicate: Can a JavaScript object have a prototype chain, but also be a
Possible Duplicate: Can I split a Mercurial repository? I have a Mercurial repository with

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.