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


Groups > comp.lang.python > #62281

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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin1!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <asmwarrior@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:Windows': 0.02; 'scripts': 0.03; 'subject:not': 0.03; 'subject:Python': 0.06; '<>,': 0.07; 'debugging': 0.07; 'mouse': 0.07; 'url:msdn': 0.07; 'key.': 0.09; 'received:192.168.1.101': 0.09; 'steps:': 0.09; 'subject:Why': 0.09; 'python': 0.11; 'itself.': 0.14; 'windows': 0.15; '"your': 0.16; 'btw:': 0.16; 'command.': 0.16; 'icon': 0.16; 'line).': 0.16; 'reproduce': 0.16; 'text",': 0.16; 'url:85)': 0.16; 'url:windows': 0.16; 'wrote:': 0.18; 'later': 0.20; 'thanks.': 0.20; '(the': 0.22; 'command': 0.22; 'import': 0.22; 'community.': 0.22; 'shell': 0.22; 'header:User-Agent:1': 0.23; 'issue,': 0.24; 'text,': 0.24; 'looks': 0.24; 'question': 0.24; 'shown': 0.26; 'task': 0.26; 'post': 0.26; 'header:In-Reply-To:1': 0.27; 'related': 0.29; 'originally': 0.30; 'program,': 0.31; 'usually': 0.31; 'ctypes': 0.31; 'skip:c 30': 0.32; 'run': 0.32; 'text': 0.33; 'subject:the': 0.34; 'problem': 0.35; 'problem.': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'activate': 0.36; 'c++': 0.36; 'data,': 0.36; 'subject:?': 0.36; 'so,': 0.37; 'url:microsoft': 0.37; 'expected': 0.38; 'message-id:@gmail.com': 0.38; 'url:library': 0.38; 'window': 0.38; 'to:addr:python-list': 0.38; 'issue': 0.38; 'visual': 0.39; 'to:addr:python.org': 0.39; 'skip:2 20': 0.60; 'solve': 0.60; 'simply': 0.61; 'first': 0.61; 'show': 0.63; 'close': 0.67; 'line,': 0.68; 'prompt': 0.68; 'url :en-us': 0.68; 'url:%1': 0.72; 'url:a': 0.72; 'click': 0.77; 'activated': 0.84; 'zhang': 0.84; 'subject:+': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=S7cBfZQxEZTS+HQ753hmNNeCZ3oF4+48AdfXPj70nxU=; b=HVgZC3zzbXQ91mLZR4Ab996/pE/B4sRHhaOWOQ+qlHK1qfHs+XJsYPT8F1oqQY8fey 5u1mlYQ1HrJZa6KhHPThLvtBspI8L0gTTAb++MGa24o2A235PnkIDACa+kuL3WsndpUk cOAghMz9lXg8ym6JUpDYvlYduZNYBG0nqZoUUNTmUpj58TpYvPYSh9EjJEL5ET7p4NxI JVPPoecK5lPC+BZNEN/C8ksFGF5iq0UUOKw+/qYjRMi8M687Ni7YAtykvhsc+9sQJfaJ YiQ6zPHQsqtIOCEQgYiI1i0o9YXm0Kdcraey3SGuohffMOZnjmTrsdDs6Mu6x+2CreGL JODQ==
X-Received by 10.68.179.35 with SMTP id dd3mr5185292pbc.138.1387355751396; Wed, 18 Dec 2013 00:35:51 -0800 (PST)
Date Wed, 18 Dec 2013 16:34:21 +0800
From asmwarrior <asmwarrior@gmail.com>
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:24.0) Gecko/20100101 Thunderbird/24.0
MIME-Version 1.0
To python-list@python.org
Subject Re: Windows+Python: Why is the first opened window not shown active?
References <52B14248.2010303@gmail.com>
In-Reply-To <52B14248.2010303@gmail.com>
Content-Type multipart/alternative; boundary="------------070907030406060900030506"
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.4337.1387355755.18130.python-list@python.org> (permalink)
Lines 138
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1387355755 news.xs4all.nl 2881 [2001:888:2000:d::a6]:33978
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:62281

Show key headers only | View raw


[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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

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

csiph-web