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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T11:31:22+00:00 2026-06-10T11:31:22+00:00

I’m using Python 2.6 with wxPython 2.8.12 to develop an application through BoaConstructor. I

  • 0

I’m using Python 2.6 with wxPython 2.8.12 to develop an application through BoaConstructor. I have an apply button programmed so that it will store some variables from TextCtrl’s and then perform a self.Destroy() call on the dialog window to close it. When I click on this button, the GUI hangs and the application freezes. However, if I do not call self.Destroy(), I am able to store the variables without a problem until I try to close the window using the X button in the top right corner of the window (tested using print commands). If I do not try to store any variables but simply perform a self.Destroy() on the press of the button, everything is fine. It is only when I try to store variables and perform a self.Destroy() that the GUI hangs. Could any body lend a hand? Thanks in advance.

    def OnApplyButton(self, event):
        print self.IMSINumberDigitTextCtrl.GetValue()
        if self.IMSINumberDigitCheckBox.GetValue() == True:
            print self.IMSINumberDigit #Debugging purposes only.  Returns expected value
            print self.IMSINumberDigitTextCtrl.GetValue() #Debugging purposes only.  Returns expected value
            self.IMSINumberDigit = self.IMSINumberDigitTextCtrl.GetValue()
            print self.IMSINumberDigit #Debugging purposes only.  Returns expected value
    self.Destroy()

Edit: this refers to Mike’s suggestion. These are the two files for the smaller program I tested which worked flawlessly.

#!/usr/bin/env python
#Boa:App:BoaApp

import wx

import Frame1

modules = {'Frame1': [1, 'Main frame of Application', u'Frame1.py']}

class BoaApp(wx.App):
    def OnInit(self):
        self.main = Frame1.create(None)
        self.main.Show()
        self.SetTopWindow(self.main)
        return True

def main():
    application = BoaApp(0)
    application.MainLoop()

if __name__ == '__main__':
    main()

And

#Boa:Frame:Frame1

import wx

def create(parent):
    return Frame1(parent)

[wxID_FRAME1, wxID_FRAME1APPLY, wxID_FRAME1CHECKBOX1, wxID_FRAME1CHECKBOX2, 
 wxID_FRAME1TEXTCTRL1, 
] = [wx.NewId() for _init_ctrls in range(5)]

class Frame1(wx.Frame):
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt,
              pos=wx.Point(480, 245), size=wx.Size(279, 135),
              style=wx.DEFAULT_FRAME_STYLE, title='Frame1')
        self.SetClientSize(wx.Size(279, 135))

        self.checkBox1 = wx.CheckBox(id=wxID_FRAME1CHECKBOX1, label='checkBox1',
              name='checkBox1', parent=self, pos=wx.Point(24, 16),
              size=wx.Size(95, 22), style=0)
        self.checkBox1.Bind(wx.EVT_CHECKBOX, self.OnCheckBox1Checkbox,
              id=wxID_FRAME1CHECKBOX1)

        self.checkBox2 = wx.CheckBox(id=wxID_FRAME1CHECKBOX2, label='checkBox2',
              name='checkBox2', parent=self, pos=wx.Point(48, 48),
              size=wx.Size(95, 22), style=0)
        self.checkBox2.Enable(False)
        self.checkBox2.Bind(wx.EVT_CHECKBOX, self.OnCheckBox2Checkbox,
              id=wxID_FRAME1CHECKBOX2)

        self.Apply = wx.Button(id=wxID_FRAME1APPLY, label=u'Apply',
              name=u'Apply', parent=self, pos=wx.Point(24, 88),
              size=wx.Size(232, 29), style=0)
        self.Apply.Bind(wx.EVT_BUTTON, self.OnApplyButton, id=wxID_FRAME1APPLY)

        self.textCtrl1 = wx.TextCtrl(id=wxID_FRAME1TEXTCTRL1, name='textCtrl1',
              parent=self, pos=wx.Point(160, 44), size=wx.Size(80, 27), style=0,
              value='textCtrl1')
        self.textCtrl1.SetEditable(True)
        self.textCtrl1.Enable(False)

    def __init__(self, parent):
        self._init_ctrls(parent)
        self.TextCtrlVariableHolder = None

    def OnCheckBox1Checkbox(self, event):
        value = self.checkBox1.GetValue()
        if value == True:
            self.checkBox2.Enable(True)
        else:
            self.checkBox2.Enable(False)

    def OnCheckBox2Checkbox(self, event):
        value = self.checkBox2.GetValue()
        if value == True:
            self.textCtrl1.Enable(True)
        else:
            self.textCtrl1.Enable(False)

    def OnApplyButton(self, event):
        print self.textCtrl1.GetValue()
        if self.checkBox2.GetValue() == True:
            print self.TextCtrlVariableHolder
            print self.textCtrl1.GetValue()
            self.TextCtrlVariableHolder = self.textCtrl1.GetValue()
            print self.TextCtrlVariableHolder
        self.Destroy()

Thanks!

  • 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-10T11:31:24+00:00Added an answer on June 10, 2026 at 11:31 am

    Turns out the issue was my own coding, which I suspected all along but couldn’t isolate. I had an infinite loop running due to the way in which I captured values. TextCtrls return strings, not ints. Who knew. So in the frame that the dialog was spawned from, i < “StringThatIThoughtWasAnINT” would never escape. Thanks for all your help though @MikeDriscoll!

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need a function that will clean a strings' special characters. I do NOT
I have thousands of HTML files to process using Groovy/Java and I need to
I am trying to loop through a bunch of documents I have to put
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i

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.