| Store | Cart

[python-win32] Interaction between wxPython and win32ui on Win 7

From: Dietmar Schwertberger <mail...@schwertberger.de>
Sat, 07 May 2011 12:32:57 +0200
Hi!

I'm observing some strange interaction between wxPython and win32ui
on Windows 7 PCs.

I've been using DDE code from Pythonwin which in turn uses win32ui.
When I use win32ui and SetToolTipString from wxPython in the same
program, the Python interpreter will not exit any more (until it's
killed from the task manager or by closing the console window.)
See below for the code.
If I omit "import win32ui" or "panel.SetToolTipString(...)", then
the interpreter will exit as expected.

I've posted the problem on the wxPython mailing list and Robin Dunn
suggested the workaround of calling wx.Exit(), which is more or less
the equivalent to killing the interpreter.

Robin's comment:
 > It seems that something that is done during the import of win32ui> is  conflicting somehow with what is done when a wxToolTip object> is created.  The wx side of things is not too complex, it basically> just adds a new WndProc function to the chain of WndProcs for the> window that will respond to the tooltip messages. Maybe win32ui is> doing something similar and is getting stuck when it is trying to> clean up at exit?

Am I missing anything? Is there e.g. a finalize function or something
like that? Calling wx.Exit() works for me, but it's not a nice way
to finish...



The versions:
  pywin32 build 216
  wxPython 2.8.12.0 or 2.8.11.0
  Python 2.7 (same with 2.6 and an older version of wxPython and pywin32)
With Windows XP or 2000 everything works as expected. I think I had the
problem already with Vista, but I'm not sure.
One user has reported that the code works for him under Win7 with Python
2.6.5.


Regards,

Dietmar


import wx
import win32ui

class MyFrame(wx.Frame):
     def __init__(self, parent):
         wx.Frame.__init__(self, parent, -1, "test frame")
         panel = wx.Panel(self, -1)
         panel.SetToolTipString("test")
         self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
     def OnCloseWindow(self, event):
         self.Destroy()

import sys
app = wx.App()
frame = MyFrame(None)
frame.Show(True)
app.MainLoop()

print "calling sys.exit()"
sys.exit()

_______________________________________________
python-win32 mailing list
pyth...@python.org
http://mail.python.org/mailman/listinfo/python-win32

Recent Messages in this Thread
Dietmar Schwertberger May 07, 2011 10:32 am
Michel Claveau May 07, 2011 01:33 pm
Mark Hammond May 09, 2011 01:03 am
Dietmar Schwertberger May 09, 2011 06:56 pm
Messages in this thread