Mailing List Archive

Pythonwin - advise sought
--------------21278690334011C527C510E6
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I am looking at Pythonwin as an alternative to Tk and would appreciate advice on
the following three questions.

The Pythonwin documentation points to MFC documents as a source of information.
The MSDN site has:

http://msdn.microsoft.com/library/devprods/vs6/vc++/vcmfc/_mfc_about_the_microsoft_foundation_classes.htm'''

Q1: Are there better sources which can be recommended?

The code fragment below:

code1= "win32ui.CreateFileDialog(1)"
fd= eval(code)
print(repr(fd))

produces the result:

object 'PyCFileDialog' - assoc is 007CC240, vf=False,
notify=0,ch/u=0/0, mh=0,kh=0

Q2. What do these various symbols and their values mean?

type(fd) returns the type of the class.

Q3. Is there some way that one can test that fd is an instance of some class,
any class?

Thanks for any help.

Colin W.

--------------21278690334011C527C510E6
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
I am looking at Pythonwin as an alternative to Tk and would appreciate
advice on the following three questions.
<p>The Pythonwin documentation points to MFC documents as a source of information.&nbsp;
The MSDN site has:
<br>&nbsp;&nbsp;&nbsp; <a href="http://msdn.microsoft.com/library/devprods/vs6/vc++/vcmfc/_mfc_about_the_microsoft_foundation_classes.htm">http://msdn.microsoft.com/library/devprods/vs6/vc++/vcmfc/_mfc_about_the_microsoft_foundation_classes.htm</a>'''
<p>Q1:&nbsp; Are there better sources which can be recommended?
<p>The code fragment below:
<blockquote>&nbsp; code1= "win32ui.CreateFileDialog(1)"
<br>&nbsp; fd= eval(code)
<br>&nbsp; print(repr(fd))</blockquote>
&nbsp;&nbsp;&nbsp;&nbsp; produces the result:
<blockquote>object 'PyCFileDialog' - assoc is 007CC240, vf=False, notify=0,ch/u=0/0,
mh=0,kh=0</blockquote>
Q2.&nbsp; What do these various symbols and their values mean?
<p>&nbsp;&nbsp;&nbsp; type(fd) returns the type of the class.
<p>Q3.&nbsp; Is there some way that one can test that fd is an instance
of some class, any class?
<p>Thanks for any help.
<p>Colin W.</html>

--------------21278690334011C527C510E6--
Pythonwin - advise sought [ In reply to ]
Colin J. Williams wrote in message <375FA468.98976DDF@connection.com>...
>I am looking at Pythonwin as an alternative to Tk and would appreciate
advice on
>the following three questions.
>
>The Pythonwin documentation points to MFC documents as a source of
information.
>The MSDN site has:
>
>http://msdn.microsoft.com/library/devprods/vs6/vc++/vcmfc/_mfc_about_the_mi
crosoft_foundation_classes.htm'''
>
>Q1: Are there better sources which can be recommended?

Not buy me. Ive been doing MFC for years now and never owned a book on it
:-(

>The code fragment below:
>
> code1= "win32ui.CreateFileDialog(1)"
> fd= eval(code)
> print(repr(fd))
Or:
print repr(win32ui.CreateFileDialog(1)) :-)

> object 'PyCFileDialog' - assoc is 007CC240, vf=False,
> notify=0,ch/u=0/0, mh=0,kh=0

These are really for debugging:
assoc is: The address of the MFC object wrapped (ie, the CFileDialog)
vf=false: Is there a .py class associated with this C+ object?
notify=0: How many HookNotify() calls have been made on the object
ch/i=0/0: Can't remember - use the source :-)
mh=0: How many HookMessage calls.
kh=0: How many keyboard handlers.

>Q3. Is there some way that one can test that fd is an instance of some
class,
>any class?

FD is not a class, it is a type. There are no good examples for a file
dialog, but consider:

>>> ps=win32ui.CreatePropertySheet("Test")
>>> ps
object 'PyCPropertySheet' - assoc is 01102980, vf=False, notify=0,ch/u=0/0,
mh=0, kh=0
>>>

Same as your example. Now lets create a property sheet using a Python
class:

>>> ps=pywin.mfc.dialog.PropertySheet("Test")
>>> ps
<pywin.mfc.dialog.PropertySheet instance at 1103080>

Now it is a Python class. We can get the win32ui type object by looking at
_obj_ - ie:
>>> ps._obj_
object 'PyCPropertySheet' - assoc is 01104F10, vf=True, notify=0,ch/u=0/0,
mh=1, kh=0
>>>

Note in this example we have "mh=1" indicating that the
pywin.dialog.PropertySheet class hooked a single windows message.

Hope this helps...

Mark.