[python-win32] PyGUI blobedit creashes with pywin32-214 but not 212 - traceback - related problems

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Oct 21 04:31:05 CEST 2010


On 21/10/10 14:02, Roger Upole wrote:

> The problem stems from these 2 lines in ScrollableViews.py:
>
> rev = ui.CreateRichEditView()
> win_dummy_doc = rev.GetDocument()
>
> The win32ui framework really should not allow a view to be created
> without a valid document.

Actually, the problem is that it *won't* allow a view to be
created without a document, even though it should. If I remember
correctly, at the MFC level, the constructor for the view object
I'm using doesn't even take a Document as an argument -- you set
it later if you want one. Win32ui goes out of its way to accept
one at construction time.

This wouldn't be such a serious problem, except that win32ui
doesn't seem to provide any way of creating a Document without
a resource -- hence the above kludge.

> The PyGUI framework can probably create a valid MFC document to use
> as a dummy with a little work.
> Something like:
> dt=win32ui.CreateDocTemplate(win32ui.IDR_PYTHONTYPE)
> win_dummy_doc=dt.DoCreateDoc()

That may work if you run the program using the pythonwin
executable, which contains the referenced resource. But I want
pygui programs to be runnable using the standard Python
interpreter, which means I can't rely on resources at all.

There are two ways that pywin32 could be modified to fix this
problem:

1) Allow a View to be created without a Document (preferable).

2) Provide a way of creating a Document without requiring a
resource (e.g. from a string template).

-- 
Greg


More information about the python-win32 mailing list