<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"></head><body bgcolor="#FFFFFF" text="#000000"><tt>Hello, Python community.<br><br></tt>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:

<div class="post-text" itemprop="description"><ol><li>start a Python command line prompt(this is usually to hit the Start Menu->Python 2.7->Python(command line).  </li><li><p>type the following text, and hit Enter key.</p>

<pre style="" class="lang-py prettyprint prettyprinted"><code><span class="kwd">import</span><span class="pln"> ctypes</span></code></pre></li><li><p>type the following text, and hit Enter key.</p>

<pre style="" class="lang-py prettyprint prettyprinted"><code><span class="pln">ctypes</span><span class="pun">.</span><span class="pln">windll</span><span class="pun">.</span><span class="pln">user32</span><span class="pun">.</span><span class="typ">MessageBoxA</span><span class="pun">(</span><span class="lit">0</span><span class="pun">,</span><span class="pln"> </span><span class="str">"Your text"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"Your title"</span><span class="pun">,</span><span class="pln"> </span><span class="lit">1</span><span class="pun">)</span></code></pre></li><li>You will see a message box opened, but this message box window is not activated.  </li><li>Use the mouse to click on the icon of the message box in task bar to activate the message box  </li><li>Close the message box  </li><li><p>type the text again in the Python prompt shell</p>

<pre style="" class="lang-py prettyprint prettyprinted"><code><span class="pln">ctypes</span><span class="pun">.</span><span class="pln">windll</span><span class="pun">.</span><span class="pln">user32</span><span class="pun">.</span><span class="typ">MessageBoxA</span><span class="pun">(</span><span class="lit">0</span><span class="pun">,</span><span class="pln"> </span><span class="str">"Your text"</span><span class="pun">,</span><span class="pln"> </span><span class="str">"Your title"</span><span class="pun">,</span><span class="pln"> </span><span class="lit">1</span><span class="pun">)</span></code></pre></li><li>Now, the message box is showed activated (the expected behavior) </li></ol>

<p>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 <a href="http://stackoverflow.com/questions/16227166/gdb-cvmat-python-object-issue-when-debugging-a-c-program">GDB cv::Mat python object issue when debugging a c++ program</a>, I need to show the OpenCV Image window immediately after I type the plot command.</p>

<p>But later I found that this is an issue related to Python itself.<br></p><p><br>Thanks.<br></p><p>Yuanhui Zhang<br></p><p>BTW: I post the same question in StackOverflow: <a class="moz-txt-link-freetext" href="http://stackoverflow.com/questions/20614249/windowspython-why-is-the-first-opened-window-not-shown-active">http://stackoverflow.com/questions/20614249/windowspython-why-is-the-first-opened-window-not-shown-active</a><br></p><p><br></p>

    </div></body></html>