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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:32:57+00:00 2026-05-26T10:32:57+00:00

We were using Python2.3 and wxPython V2.4.2.4 in our project. And it was working

  • 0

We were using Python2.3 and wxPython V2.4.2.4 in our project. And it was working fine. Now we are upgrading it to Python2.7 and wxPython2.8.12.1. Our project is compiled fine with new version. But in our project at one stage in the code we destroy the current window and then create & open new window again. And I have noticed that our code after creating new window does not execute. While in the old version it was executing.

In the following code. It is displaying the message “doRead 1” then open the window. But it does not display the message “doRead 2”. While in old Python version it was displaying the message “do Read 2” means it was executing the code after that.

I found that, it does not come out from the line “self.MainLoop()” in OnInit(…) function in new project. But it was coming out and thus executing the next line in old project.

-----------------------------------------
Here is the code:
#Close existing window.
self.Destroy()
print 'doRead 1'

#create new window
app = App()
print 'doRead 2'
app.frame.saveContents()
------------------------------------

class App(wx.App):
    """Application class.
    """
    def OnInit(self):
        wx.InitAllImageHandlers()
        resetOptions()
        setOptions()
        self.frame = pdtpFrame()
        self.frame.SetTitle(std.getTitle())
        self.frame.Show()
        self.SetTopWindow(self.frame)
        self.MainLoop()
        return True


def main():
    """ Start up the pdtp main window application.
    """
    app = App()

if __name__ == '__main__':
    main()
  • 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-26T10:32:57+00:00Added an answer on May 26, 2026 at 10:32 am

    Your trouble (as far as I can tell) is that you have your MainLoop inside of your OnInit function, which is halting your program flow. I can’t speak for how it worked like that before, to be honest, because you shouldn’t be able to enter the MainLoop for an App until it’s OnInit has returned True. The OnInit could return False in which case the App didn’t fully initialize (common if you’re doing single instance apps with a lock file, for example). A more common approach (pseudo-code) would look like this:

    app = wx.PySimpleApp()
    
    f = Frame(None, -1, "Some Title For This Frame")
    f.Show()
    
    app.MainLoop()
    
    # Down here more code can follow.  
    

    It won’t execute more code until after all Top Level Windows are closed from the prior App instance, or something else calls wx.GetApp().ExitMainLoop().

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

Sidebar

Related Questions

I'm building a centralized desktop application using Python/wxPython. One of the requirements is User
Using Python2.4 I want to capture output from a mysql command. One caveat is
I am new to Python. I am writing an application using wxPython and I
I am using wxPython and I want to use an OpenGL based canvas, but
I'm using python2.6. Is it available in higher version of python? Else is there
I'm writing a GUI application in Python using wxPython and I want to display
When using py2exe to distribute Python applications with wxPython, some MSVC DLLs are usually
I'm coding the menu for an application I'm writing in python, using wxPython libraries
How can use Python2.5 with to write scripts in vim? I'm using vim 7.2
I'm using Python 2.7.2 and wxPython 2.8.12.1 on Arch Linux x86_64. I'd like to

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.