Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #62281 > unrolled thread

Re: Windows+Python: Why is the first opened window not shown active?

Started byasmwarrior <asmwarrior@gmail.com>
First post2013-12-18 16:34 +0800
Last post2013-12-18 16:34 +0800
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Windows+Python: Why is the first opened window not shown active? asmwarrior <asmwarrior@gmail.com> - 2013-12-18 16:34 +0800

#62281 — Re: Windows+Python: Why is the first opened window not shown active?

Fromasmwarrior <asmwarrior@gmail.com>
Date2013-12-18 16:34 +0800
SubjectRe: Windows+Python: Why is the first opened window not shown active?
Message-ID<mailman.4337.1387355755.18130.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

On 2013-12-18 14:35, asmwarrior wrote:
> Hello, Python community.
>
> I have found a very strange problem about using the python scripts under Python Windows command line prompt, to reproduce this issue, you can simply do those steps:
>
>  1. start a Python command line prompt(this is usually to hit the Start Menu->Python 2.7->Python(command line).
> 2.
>
>     type the following text, and hit Enter key.
>
>     |import ctypes|
> 3.
>
>     type the following text, and hit Enter key.
>
>     |ctypes.windll.user32.MessageBoxA(0, "Your text", "Your title", 1)|
>  4. You will see a message box opened, but this message box window is not activated.
>  5. Use the mouse to click on the icon of the message box in task bar to activate the message box
>  6. Close the message box
> 7.
>
>     type the text again in the Python prompt shell
>
>     |ctypes.windll.user32.MessageBoxA(0, "Your text", "Your title", 1)|
>  8. Now, the message box is showed activated (the expected behavior) 
>
> So, my question is, why the first message box(window) is not shown active? I originally find this issue when I run a Python pretty printer under GDB command line, because I want to use some python pretty printer to visual the data, like this GDB cv::Mat python object issue when debugging a c++ program <http://stackoverflow.com/questions/16227166/gdb-cvmat-python-object-issue-when-debugging-a-c-program>, I need to show the OpenCV Image window immediately after I type the plot command.
>
> But later I found that this is an issue related to Python itself.
>
>
> Thanks.
>
> Yuanhui Zhang
>
> BTW: I post the same question in StackOverflow: http://stackoverflow.com/questions/20614249/windowspython-why-is-the-first-opened-window-not-shown-active
>
>
FYI:

I get the an answer in stackoverflow in the above link which solve my problem. (http://stackoverflow.com/a/20651708/154911)

It looks like the Windows OS system block a console window to create/pop-up a window, so I need some opitons like:

MB_SETFOREGROUNDWINDOW <http://msdn.microsoft.com/en-us/library/windows/desktop/ms645505%28v=vs.85%29.aspx>

Thanks.

Yuanhui Zhang

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web