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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:47:49+00:00 2026-06-01T16:47:49+00:00

I have a GUI application written with python+tkinter. In my workflow, I generally start

  • 0

I have a GUI application written with python+tkinter. In my workflow, I generally start the gui from the commandline, do some things in the gui and then I find myself navigating to other terminal windows to do some work. Inevitably, I want to shut down the GUI at some point, and out of habit I often just navigate to the terminal that started the GUI and send a KeyboardInterrupt (Ctrl-c). However, This interrupt is not recieved until I raise the GUI window in the Window manager. Does anyone know why this happens? If the gui is started in a single function, is there a simple workaround — multiprocessing maybe?

  • 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-06-01T16:47:50+00:00Added an answer on June 1, 2026 at 4:47 pm

    from the newsgroups:

    I’m using Python 1.5 under Redhat Linux 5.0. I’m trying to figure out
    the best way to trap a SIGINT (or Ctrl-C) when using tkinter. To
    illustrate the problem I have, do the following …

    — Build Python-1.5 with tkinter enabled.

    — Go into the Demo/tkinter/guido directory under the Python-1.5 build tree.

    — Type "python imageview.py image-file", where "image-file" is the full pathname of a displayable image.

    — Once the image pops up, make sure that the window focus is held by the xterm window from which the "python …" command was just
    now invoked.

    — Hit Ctrl-C.

    At this point, nothing happens. The Ctrl-C seems to be ignored. But
    now …

    — Without hitting any more keys on the keyboard, set the window focus to the displayed image window.

    As soon as that window gets the focus, the Ctrl-C takes effect.

    My question is this: is there any way to restructure the
    "imageview.py" program so that it will respond to SIGINT (Ctrl-C)
    immediately, without having to set the window focus to the displayed
    image first?

    Thanks in advance for any help you folks can give me.
    —- What you’re seeing is caused by the way signal handlers are handled. You’re stuck in the Tcl/Tk main loop, and signal handlers are
    only handled by the Python interpreter. A quick workaround is to use
    after() to schedule a dummy function to be called once a second or so
    — this will make it appear that your signal is handled in a timely manner.

    –Guido van Rossum

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

Sidebar

Related Questions

I have complex GUI application written in Python and wxPython. I want it to
I have a GUI application written in C/C++ using gcc. I need some recommendations
I have written a GUI application which after performing some analyses on a large
I'm a new bit in Qt... I have a Qt GUI application (written by
I have a C++ Win32 application that was written as a Windows GUI project,
I have written an image processing application with the GUI part written in Java
We have a mature Windows desktop application written in C++. The application's GUI sits
I'm not entirely sure this is possible. I have a legacy GUI application written
I have a rather simple multi-threaded VCL gui application written with Delphi 2007. I
I have this application (Windows form application written in Visual C++) from a colleague

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.