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

  • Home
  • SEARCH
  • 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 109787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T02:07:28+00:00 2026-05-11T02:07:28+00:00

I want to spawn another process to display an error message asynchronously while the

  • 0

I want to spawn another process to display an error message asynchronously while the rest of the application continues.

I’m using the multiprocessing module in Python 2.6 to create the process and I’m trying to display the window with TKinter.

This code worked okay on Windows, but running it on Linux the TKinter window does not appear if I call 'showerror('MyApp Error', 'Something bad happened.')'. It does appear if I run it in the same process by calling showerrorprocess directly. Given this, it seems TKinter is working properly. I can print to the console and do other things from processes spawned by multiprocessing, so it seems to be working too.

They just don’t seem to work together. Do I need to do something special to allow spawned subprocesses to create windows?

from multiprocessing import Process from Tkinter import Tk, Text, END, BOTH, DISABLED import sys import traceback  def showerrorprocess(title,text):     '''Pop up a window with the given title and text. The        text will be selectable (so you can copy it to the        clipboard) but not editable. Returns when the        window is closed.'''     root = Tk()     root.title(title)     text_box = Text(root,width=80,height=15)     text_box.pack(fill=BOTH)     text_box.insert(END,text)     text_box.config(state=DISABLED)     def quit():         root.destroy()         root.quit()     root.protocol('WM_DELETE_WINDOW', quit)     root.mainloop()  def showerror(title,text):     '''Pop up a window with the given title and text. The        text will be selectable (so you can copy it to the        clipboard) but not editable. Runs asynchronously in        a new child process.'''     process = Process(target=showerrorprocess,args=(title,text))     process.start() 

Edit

The issue seems to be that TKinter was imported by the parent process, and ‘inherited’ into the child process, but somehow its state is inextricably linked to the parent process and it cannot work in the child. So long as you make sure not to import TKinter before you spawn the child process, it will work because then it is the child process that is importing it for the first time.

  • 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. 2026-05-11T02:07:29+00:00Added an answer on May 11, 2026 at 2:07 am

    This discussion could be helpful.

    Here’s some sample problems I found:

    1. While the multiprocessing module follows threading closely, it’s definitely not an exact match. One example: since parameters to a process must be pickleable, I had to go through a lot of code changes to avoid passing Tkinter objects since these aren’t pickleable. This doesn’t occur with the threading module.

    2. process.terminate() doesn’t really work after the first attempt. The second or third attempt simply hangs the interpreter, probably because data structures are corrupted (mentioned in the API, but this is little consolation).

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

Sidebar

Ask A Question

Stats

  • Questions 86k
  • Answers 86k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Toll-free bridging means that the data structures are interchangeable. It… May 11, 2026 at 5:21 pm
  • Editorial Team
    Editorial Team added an answer It looks like you might have a problem with your… May 11, 2026 at 5:21 pm
  • Editorial Team
    Editorial Team added an answer I answered my own question. I forgot to add a… May 11, 2026 at 5:21 pm

Related Questions

I have a C linux application (A) that spawns another process (P) when it
(I'm using the pyprocessing module in this example, but replacing processing with multiprocessing should
I have written an HttpModule that spawns a background thread. I'm using the thread
I have a main page that I want to be a sort of dispatch

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.