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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:49:29+00:00 2026-06-15T22:49:29+00:00

Consider this: import wx, time # STEP 1: Setup Window class Window(wx.Frame): def __init__(self,parent,id):

  • 0

Consider this:

import wx, time

# STEP 1: Setup Window
class Window(wx.Frame):
    def __init__(self,parent,id):
        wx.Frame.__init__(self,parent,id,'Bobby the Window', size=(300,200))
        panel = wx.Panel(self)
        self.Bind(wx.EVT_CLOSE, self.closewindow)

    wx.StaticText(panel, -1, "Yo user, the program is busy doing stuff!", (50,100), (200,100))

def closewindow(self, event):
    self.Destroy()

# STEP 2: Show Window (run in background, probably with threading, if that is the best way)
if __name__=='__main__':
    app = wx.PySimpleApp()
    frame = Window(parent=None,id=-1)
    frame.Show()
    app.MainLoop()

# STEP 3: Do work
time.sleep(5)

# STEP 4: Close Window, and show user evidence of work
## *Update window to say: "I am done, heres what I got for you: ^blah blah info!^"*
exit()

My questions are:

  • In step 4, how do I change the text in the window (esp. if it is in a thread)?
  • And in step 2, how do I run the window in the background, but still be able to communicate with it? (to update the text and such)

This is similar to my question about how to run a cli progress bar and work at the same time, except with gui windows.

I know that to change StaticText, I would do ‘text.SetLabel(“BLAH!”)’, but how would I communicate that with the window class if it is running in the background?

Update:
This thread was also some help.

  • 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-15T22:49:30+00:00Added an answer on June 15, 2026 at 10:49 pm

    If you need to execute a long running process, then you will have to use some type of threading or perhaps the multiprocessing module. Otherwise you will block the GUI’s main loop and make it unresponsive. You will also need to use wxPython’s threadsafe methods to communicate with the GUI from the thread. They are wx.CallAfter, wx.CallLater and wx.PostEvent.

    You can read more about wxPython and threads at the following:

    • http://wiki.wxpython.org/LongRunningTasks
    • http://www.blog.pythonlibrary.org/2010/05/22/wxpython-and-threads/
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider this small piece of code from apscheduler.scheduler import Scheduler import time class First():
Consider this simple AS3 class. package { import flash.display.Sprite; import flash.display.MovieClip; public class MySprite
Consider this code: package Prova; import java.util.ArrayList; public class Prova { private ArrayList<String> people;
Consider this code: import java.util.*; class jm45 implements Comparator<jm45> { private int x; jm45(int
Consider this code: import java.util.regex.*; public class Pattern3 { /** * @param args the
Consider this small test class: import java.util.List; public abstract class Test { // CAN
Consider this code: import scala.xml.{Node,HasKeyValue} def domatch(x:Node): Node = { val hasBar = new
Consider this example : import java.lang.reflect.Field; public class Test { public static void main(String[]
Consider this case class: case class IntPrinter(implicit val i: Int) { def print()(implicit i:
Let's consider this piece of code as our example: import java.awt.*; class Maze extends

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.