[Tutor] pywin DoModal vs CreateWindow
nebpro at gmail.com
Wed Mar 21 18:42:25 CET 2007
Recently my friend ask me for help on pywin32 gui programming. There is one
thing that throw us off (Note. Both of us don't have any mfc background and
we are newbie in python). When the "DoModal" is called, the gui will stay in
loop. It is different when the "CreateWindow" is called. If we run the
program from command prompt, the gui won't stay in loop (or basically just
blink for a moment and disappear). It is different if we run the program
from "PythonWin" program. Can someone explain this for us? It cause a lot of
confusion. And what should we do to make the gui stay in loop if we used
"CreateWindow" and called it from command prompt. We really appreciate for
any help. Thanks in advance.
Below is the snippet code that we used for testing:
Note: Codes credits to Mark Hammond.
from pywin.mfc.dialog import Dialog
d = Dialog (win32ui.IDD_SIMPLE_INPUT)
button = d.GetDlgItem (win32ui.IDC_PROMPT1)
print "button: ", button
button.SetWindowText ("Hello from Python")
d.SetWindowText ("Python is awesome")
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor