I need some help. I cant seem to get rid of this error.
I can program a button that will exit the program and remove the icon in
the taskbar, but I have to tie it to OnTaskBarClose.
OnExit and OnCloseWindow do nothing and leave the icon in the taskbar, I
think I have tried every option, when you double click the icon it gives
you the error.
Traceback (most recent call last):
File "D:/Python24/simple.py", line 43, in OnTaskBarActiva te
self.Show(true)
File "D:\Python24\Li b\site-packages\wx-2.5.4-msw-unicode\wx\_cor e.py",
line 11263, in __getattr__
raise PyDeadObjectErr or(self.attrStr % self._name)
wx._core.PyDead ObjectError: The C++ part of the MyFrame object has been
deleted, attribute access no longer allowed.
When the program runs, you can right click on the icon in the taskbar
and close and it works.
I hardcoded the file > Exit button to do the same thing and that works
too.
However if you click the top right X to just close the window, or on
close that's when the error happens.
How do I get the close to work properly from the default window? I have
been on this same thing for days. Any help would be greatly appreciated.
Heres the code, also attaching it.
from wxPython.wx import *
import sys
import os
ID_ABOUT = 101
ID_EXIT = 102
class MyFrame(wxFrame ):
def __init__(self, NULL, ID, title):
wxFrame.__init_ _(self, NULL, ID, title,
wxDefaultPositi on, wxSize(200, 150))
self.CreateStat usBar()
self.SetStatusT ext("This is the statusbar")
menu = wxMenu()
menu.Append(ID_ ABOUT, "&About",
"More information about this program")
menu.AppendSepa rator()
menu.Append(ID_ EXIT, "E&xit", "Terminate the program")
menuBar = wxMenuBar()
menuBar.Append( menu, "&File");
self.SetMenuBar (menuBar)
EVT_MENU(self, ID_ABOUT, self.OnAbout)
EVT_MENU(self, ID_EXIT, self.OnTaskBarC lose)
# make the TaskBar icon
self.tbIcon = wxTaskBarIcon()
# FIX ME WITH your Icon
icon = wxIcon('small.i co', wxBITMAP_TYPE_I CO)
self.tbIcon.Set Icon(icon, "It Doesnt work!")
EVT_TASKBAR_LEF T_DCLICK(self.t bIcon, self.OnTaskBarA ctivate)
EVT_TASKBAR_RIG HT_UP(self.tbIc on, self.OnTaskBarM enu)
EVT_MENU(self.t bIcon, self.TBMENU_CLO SE, self.OnTaskBarC lose)
EVT_ICONIZE(sel f, self.OnIconify)
def OnIconify(self, evt):
self.Hide()
def OnTaskBarActiva te(self, event):
self.Show(true)
TBMENU_CLOSE = 1001
def OnTaskBarMenu(s elf, event):
menu = wxMenu()
menu.Append(sel f.TBMENU_CLOSE, "Close")
self.tbIcon.Pop upMenu(menu)
menu.Destroy()
def OnOK(self, event):
self.Show(false )
def OnExit(self, event):
del self.tbIcon
sys.exit()
def OnCloseWindow(s elf, event):
del self.tbIcon
sys.exit()
def OnTaskBarClose( self, event):
del self.tbIcon
sys.exit()
def OnAbout(self, event):
dlg = wxMessageDialog (self, "This sample program shows off\n"
"frames, menus, statusbars, and this\n"
"message dialog.",
"About Me", wxOK | wxICON_INFORMAT ION)
dlg.ShowModal()
dlg.Destroy()
def TimeToQuit(self , event):
self.Destroy()
class MyApp(wxApp):
def OnInit(self):
frame = MyFrame(NULL, -1, "Hello from wxPython")
frame.Show(true )
self.SetTopWind ow(frame)
return true
app = MyApp(0)
app.MainLoop() 0 2008 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: python newbie |
last post by:
Hi,
I have a wxPython app which dump errors when I close it ( in
the debug output at bottom of Komodo, when I close my app. )
Where I got the code for my GUI:
Straight from the wxProject.py file which comes with the samples:
----
C:\Python23\Lib\site-packages\wx\samples\wxProject\wxProject.py ----
It basically consists of a splitterwindow, and I have a wxPanel
|
by: andrea_gavana |
last post by:
Hello Alex,
first of all, I would suggest you to upgrade wxPython to 2.5.5.1. There
is no particular reason to stick with 2.4, whatever someone else is thinkink/saying.
Secondly, I strongly suggest you to abandon the syntax:
from wxPython.wx import *
And to use:
|
by: Jeff Magouirk |
last post by:
Dear All,
I have written an update trigger that should write a message to an audit
table When I try to update any field in the table I recieve the following
error message -
Stirng or Binary data would be
trunicated
The statement has been termined.
|
by: Bill Short |
last post by:
Hello All,
I have a popup form that is called from a command button on the main
form. The main form's data source is tblA. The data source for the
popup form is a query that is based on tblA. The OnClose event of the
popup attempts to change data in a text box on the main form if
certain changes have been made on the popup.
Because both use the same data source I have tried saving the record
before attempting to make the changes, I...
|
by: Earth Worm Jim |
last post by:
I am using VS.Net 2003 on Windows 2003 Server (standard edition) and I am
getting "The process cannot access the file because it is being used by
another process" on DLL's in a VS.Net solution.
I have made sure all the dependancies and the build order is correct but the
actually instance of VS.Net (devenv.exe) is LOCKING THE DAM DLL'S IT IS
TRYING TO BUILD. ?????
I have used Process Explorer from sysinternals.com to confirm this.
| |
by: Amos |
last post by:
In framework 1.0,
In my Windows application in the breakpoints I add to one of the classes, I
get this message: "The breakpoint will not currently be hit. No symbols have
been loaded for this document".
The only thing I did (that I remember) was change the name of the solution
and modify the Project Dependencies.
I searched in the Net but the only cases I found are for Web applications.
|
by: Ole |
last post by:
Hi,
Using VS2005 and a windows CE 5.0 device running CF2. Suddenly I can't debug
my C# program from VS2005 - when setting a breakpoint I only see a ring
instead of the normal red dot and when holding the mouse over it I see a
message saying: "The breakpoint will not currently be hit. The specified
module has not been loaded". I have no problem when debugging a normal full
framework application. I have not changed anything in my settings...
|
by: guy.flowers |
last post by:
Hi
Have a problem, Ill give some history to the problem and add a little
example code to start with
to see if anybody can help or if I am correct in what the problem is.
I have been looking on the newsgroups and have found lots of stuff on
the problem
but no solutions as of yet, will keep looking here to see if I can find
one that fits.
|
by: LiveCycle |
last post by:
Hi,
I've got a longstanding project that's been working fine for about a year.
I was working on one of the pages, a simple download page. After making a
little tweak on the page, I tried to re-run the project and got the error:
The server block is not well formed. Page: FileDownload.aspx, line 23935.
Now, there are only about 50 lines on this page, so something's off. I've
tried rebooting. I've tried Rebuild Solution. I've...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |