Hi all,
Python:2.5
OS: Windows XP
I have posted couple questions regarding the wxPython. Since I am still a newbie to Python, wxPython makes more sense to me than pyWin for gui programming. But 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). When the "DoModal" is called, the gui will stay in loop. It is different when the "CreateWindow" is called. And we run the program from command prompt, the gui won't stay in loop (or basically just blink for a moment and disappear). Can someone explain this for us? And what should we do to make the gui stay in loop if we used "CreateWindow". We really appreciate for any help. Thanks in advance.
3 3819
Hi all,
Python:2.5
OS: Windows XP
I have posted couple questions regarding the wxPython. Since I am still a newbie to Python, wxPython makes more sense to me than pyWin for gui programming. But 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). When the "DoModal" is called, the gui will stay in loop. It is different when the "CreateWindow" is called. And we run the program from command prompt, the gui won't stay in loop (or basically just blink for a moment and disappear). Can someone explain this for us? And what should we do to make the gui stay in loop if we used "CreateWindow". We really appreciate for any help. Thanks in advance.
Sounds like a MainLoop() issue. Typically, (in other GTKs) "create" would be like Show() and return control to MainLoop() for event processing.
Sorry, I still don't know anyone who uses PythonWin, for the very reason that you need to know MFC.
Update:
We just did a quick test running our simple program on the "PythonWin" program instead of the command program, and the gui is staying in the loop. We really appreciate if someone can help us out with all the confusion that we have. Thanks.
By the way, here is the simple code that we try on:
Note: Codes credits to Mark Hammond. -
import win32ui
-
import win32con
-
from pywin.mfc.dialog import Dialog
-
-
d = Dialog (win32ui.IDD_SIMPLE_INPUT)
-
-
print d
-
print d._obj_
-
-
d.CreateWindow ()
-
#d.ShowWindow (win32con.SW_SHOWNORMAL)
-
button = d.GetDlgItem (win32ui.IDC_PROMPT1)
-
print "button: ", button
-
button.SetWindowText ("Hello from Python")
-
d.SetWindowText ("Python is awesome")
-
Update:
We just did a quick test running our simple program on the "PythonWin" program instead of the command program, and the gui is staying in the loop. We really appreciate if someone can help us out with all the confusion that we have. Thanks.
By the way, here is the simple code that we try on:
Note: Codes credits to Mark Hammond. -
import win32ui
-
import win32con
-
from pywin.mfc.dialog import Dialog
-
-
d = Dialog (win32ui.IDD_SIMPLE_INPUT)
-
-
print d
-
print d._obj_
-
-
d.CreateWindow ()
-
#d.ShowWindow (win32con.SW_SHOWNORMAL)
-
button = d.GetDlgItem (win32ui.IDC_PROMPT1)
-
print "button: ", button
-
button.SetWindowText ("Hello from Python")
-
d.SetWindowText ("Python is awesome")
-
I do know tha Mr. Hammond put some special work into the PythonWin IDE to handle GUI application degugging. That's probably what's keeping the window open. Mr. Hammond's book is very expensive, but I have seen it used on amazon.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: The Jetman |
last post by:
I'm trying to port PyWin into a limited version of Windows XP, called
BartPE. Essentially, it's a matter of taking the installed elements of
most WinApps (ie. registry settings and files) and...
|
by: Clive Moore |
last post by:
Is it possible to load a CDialog from my application and display it
without stopping the excution of a program. I have tried calling
doModal from the initinstance function but this stops
the rest...
|
by: Jeff Adams |
last post by:
I am using MSVC .NET to create a C program. I am having trouble creating a
window. The createwindow returns NULL however no error is caught. The
GetLastError() returns "operation completed...
|
by: Charles Krug |
last post by:
Here's the deal:
I've a dead-simple command-line program I'm using to test things that I
can't (for various reasons) test in the IDE.
Here's a do-nothing subset that shows the idea:
#...
|
by: Mr. Roboto |
last post by:
Folks: I want to embark on a project to add Python (actually, wxPython
or PythonWin) to a new Windows app I want to start writing soon.
Essentially, I want to take VB6 (or pos Delphi) and...
|
by: shakthi |
last post by:
hi,
Am trying to create a dialog box in MFC that has two buttons and an edit control.When i click button1,a dialog box that displays all the files in the system is displayed.when i select a...
|
by: Richard Gordon |
last post by:
I've got a fatal bug using Parente's pyTTS with Python 2.3 on Windoze 32
using MS SAPI 5.1 and Hammond's win32 module. The test program is
import pyTTS
tts = pyTTS.Create()
tts.Speak('Hello...
|
by: Richard Gordon |
last post by:
Sorry if this is sent twice, but I didn't see it get posted the first time.
I've got a fatal bug using Parente's pyTTS with Python 2.3 on Windoze 32
using MS SAPI 5.1 and Hammond's win32 module....
|
by: hitencontractor |
last post by:
I am working on .NET Version 2003 making an SDI application that calls MS Excel 2003.
I added a menu item called "MyApp Help" in the end of the menu bar to show Help-> About.
The application...
|
by: DolphinDB |
last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation.
Take...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |