I do Get errors with combo box selections. here is my combo selection attach to a button.

def Btn9(self, event): # wxGlade: Appli.<event_handler>
        if self.combo_box_4.GetValue()=="1":
		numglobals.frame_12.Show()
	elif self.combo_box_4.GetValue()=="2":
		numglobals.frame_13.Show()
	elif self.combo_box_4.GetValue()=="3":
		numglobals.frame_14.Show()
	elif self.combo_box_4.GetValue()=="4":
		numglobals.frame_15.Show()
	elif self.combo_box_4.GetValue()=="5":
		numglobals.frame_16.Show()
	elif self.combo_box_4.GetValue()=="6":
		numglobals.frame_17.Show()
	elif self.combo_box_4.GetValue()=="7":
		numglobals.frame_18.Show()
	elif self.combo_box_4.GetValue()=="8":
		numglobals.frame_19.Show()
	elif self.combo_box_4.GetValue()=="9":
		numglobals.frame_20.Show()
	elif self.combo_box_4.GetValue()=="10":
		numglobals.frame_21.Show()

GUI is perfectly works for the 1st selection. but if i did a same selection twice its not working. it gives an exucution error. it says

isukoon@isukoon-desktop:~/Desktop/Numeric$ python main.py 
Event handler `Combo4' not implemented
Traceback (most recent call last):
  File "/home/isukoon/Desktop/Numeric/numlib/Appli.py", line 190, in Btn9
    numglobals.frame_19.Show()
  File "/usr/lib/python2.6/dist-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 14564, in __getattr__
    raise PyDeadObjectError(self.attrStr % self._name)
wx._core.PyDeadObjectError: The C++ part of the Table8 object has been deleted, attribute access no longer allowed.

Will someone help me to fix it.

Recommended Answers

All 3 Replies

numglobals.frame_19.Show()

It appears that you haven't defined numglobals.frame_19. Check the variable name and also see if any of the others work. Note also that numglobals has not been passed to the function so the function may not be aware of it.

No i did all those things. Here Is my main.py code

import wxversion
wxversion.select('2.8')

import wx
import wx.lib.colourdb
import string

import sys
import os
import numglobals
dirname, filename = os.path.split(os.path.abspath(__file__))
sys.path.append(dirname + "/numlib")


from home import *
from Appli import *
from matrix import *
from table import *


numglobals.dirname = dirname

if __name__ == "__main__":
    app = wx.PySimpleApp(0)
    wx.InitAllImageHandlers()
    
    numglobals.frame_1 = Home(None, -1, "")
    numglobals.frame_2 = Appli(None,-1,"")
    
    app.SetTopWindow(numglobals.frame_1)
    numglobals.frame_1.Show()
    
    numglobals.frame_3 = Mat2(None,-1,"")
    numglobals.frame_4 = Mat3(None,-1,"")
    numglobals.frame_5 = Mat4(None,-1,"")
    numglobals.frame_6 = Mat5(None,-1,"")
    numglobals.frame_7 = Mat6(None,-1,"")
    numglobals.frame_8 = Mat7(None,-1,"")
    numglobals.frame_9 = Mat8(None,-1,"")
    numglobals.frame_10 = Mat9(None,-1,"")
    numglobals.frame_11 = Mat10(None,-1,"")
    numglobals.frame_12 = Table1(None,-1,"")
    numglobals.frame_13 = Table2(None,-1,"")
    numglobals.frame_14 = Table3(None,-1,"")
    numglobals.frame_15 = Table4(None,-1,"")
    numglobals.frame_16 = Table5(None,-1,"")
    numglobals.frame_17 = Table6(None,-1,"")
    numglobals.frame_18 = Table7(None,-1,"")
    numglobals.frame_19 = Table8(None,-1,"")
    numglobals.frame_20 = Table9(None,-1,"")
    numglobals.frame_21 = Table10(None,-1,"")
    app.MainLoop()

I also import numglobals in home.py, Appli.py, matrix.py & table.py files.

This code is ugly, use lists, eg

numglobals.frame[10] = Mat[9](None,-1,"")
if self.combo_box[4].GetValue() == "1":
    ...
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.