2

Running into an error that I've never heard of. I have a task manager that you can minimize to the system tray and when you left click the icon it will reopen but when I do this i get an Pydeadobjecterror. I think it has something to do with the fact that I had two inheritances for one wxpyton class. I then deleted that inheritance and now I'm having errors. Here is the error:

Traceback (most recent call last):
    File "C:\Python27\TrayIcon.py", line 25, in LeftClick
       self.frame.Show()
   File "C:\Python27\lib\site-packages\wx-2.8-msw-unicode\wx\_core.py", line 14619, in __getattr__
   raise PyDeadObjectError(self.attrStr % self._name)
wx._core.PyDeadObjectError: The C++ part of the MainFrame object has been deleted, attribute access no longer    allowed.

so any way I haven't had time to split my code up to multiple files so the code is about 400 lines long so I just pasted it on something easier than pasting it here sorry about that but heres the link http://bpaste.net/show/liDNQVppFldurLcCfvK8/ and apparently this is the code where the error is http://bpaste.net/show/etcWMPqFC8H6NQRG7uYV/

if some one could help me that would be great

7
  • too much code... but basically self.frame has been destroyed prior to trying to show it ... Commented Aug 12, 2013 at 23:57
  • where i dont destroy it anywhere unless you left click the icon? Commented Aug 12, 2013 at 23:59
  • presumably some point prior to C:\Python27\TrayIcon.py line 25 in LeftClick... Im guessing when you "minimize" the frame you are destroying it ... but you dont even have a leftclick function in the code you posted ... which is where you are getting the error ... Commented Aug 13, 2013 at 0:03
  • i posted the wrong code then i have another code where it minimizes to the system try give me a second ill post that coe Commented Aug 13, 2013 at 0:08
  • @JoranBeasley i updated with the code of trayicon but all it is is showing it not destroy it Commented Aug 13, 2013 at 0:10

1 Answer 1

5

If you are closing the frame with the X, then you are destroying the frame. You need to Hide it instead. I wrote a couple of tutorials about this that you might want to take a look at:

The basic idea is to catch EVT_CLOSE and Hide the frame instead of closing it. You only close the app by right-clicking the system tray icon. You also want to catch EVT_ICONIZE so that when you minimize the frame, you can hide the frame.

Sign up to request clarification or add additional context in comments.

6 Comments

Mike's Blog is literally one of the best python sources on the nets. especially for wx stuff... I probably goto his blog more than I goto the docs :P
Thanks! I'm glad you use it so much.
it had been working previously is the wierd thing. Love your blog! the docs are somewhat terible as they dont give good examples. unlike mike's blog hence where i got my script from i just took it a couple of step farther
i caught EVT_CLOSE and used onClose to hide it to the tray icon
If Phoenix ever gets finished, the documentation is supposed to get better as it will be easier to edit. Here's hoping that happens soon.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.