what is the reason that frame.Show() does not show up any window?

Hi, I can successfully create a wxFrame under GDB’s python interface, the command I run was “source sim.py”, the sim.py contains such code:
import wx
app = wx.App()
frame = wx.Frame(None, -1, ‘simple.py’)
frame.Show()
app.MainLoop()Enter code here…

``

Here is the screen shot when a wxFrame is show. See the image shot here:
http://i683.photobucket.com/albums/vv194/ollydbg_cb/2014-07-28230509_zps79309703.png
I was testing under WinXP.

Now, I would like run the same command under Code::Blocks IDE, here the IDE works as a front end of GDB, and the IDE communicates GDB with pipes (stdin, stdout, stderror), but strange that the same command “source sim.py” don’t show any Frame window.

If I run the sim.py script line by line under a normal command line GDB, I noticed that after I type the “python frame.Show()” command, a window will pop up, though the window’s content is not updated until I run the command “app.MainLoop()”, which cause the event goes to this window.

But under Code::Blocks’ IDE, after I type the “python frame.Show()”, no window was pop up, the strange thing is:
if I type “python print frame.GetPosition()”, I do get the response “(88, 88)”,
if I type “python print frame.GetSize()”, I do get the response “(400, 250)”,
and both “python print frame.IsShown()” and “python print frame.IsShownOnScreen()” will return “True”.

So, the wxPython system just though the window is shown, but I can’t see the any window, where is the window?

Any hints about this?

Thanks.

BTW: I have checked the “PATH” and “PYTHON_PATH”, and both of the two sessions are the same.
I have also post this question in Code::Blocks’ forum: my post in Code::Blocks forum.

asmwarrior(ollydbg)

Hi, I did some further research about this issue.

It looks like the missing window(hidden window) has a window style “WS_VISIBLE” missing. (See the two screen shot below)
when frame.Show() called from Windows Command Line(console window) of GDB, the “WS_VISIBLE” are here:
http://i683.photobucket.com/albums/vv194/ollydbg_cb/show_zpsedd89149.png
When frame.Show() called from Code::Blocks, which the GDB.exe is a hidden process, then the window don’t have “WS_VISIBLE”, see here:
http://i683.photobucket.com/albums/vv194/ollydbg_cb/hid1_zps63cf02d8.png
I use the SPY++ tool to see the difference.

I just look at how the “WS_VISIBLE” can be used to create the wxFrame, but to bad, refer to this document( http://wxpython.org/Phoenix/docs/html/Window.html#window ), I can’t add “WS_VISIBLE” style for a new wxFrame.

Question: does the “WS_VISIBLE” property of wxWindow is just inherited from the process?

Try calling wx.Yield()

···

On Monday, July 28, 2014 5:48:16 PM UTC-7, asm warrior wrote:

Hi, I can successfully create a wxFrame under GDB’s python interface, the command I run was “source sim.py”, the sim.py contains such code:
import wx
app = wx.App()
frame = wx.Frame(None, -1, ‘simple.py’)
frame.Show()
app.MainLoop()Enter code here…

``

Here is the screen shot when a wxFrame is show. See the image shot here:
http://i683.photobucket.com/albums/vv194/ollydbg_cb/2014-07-28230509_zps79309703.png
I was testing under WinXP.

Now, I would like run the same command under Code::Blocks IDE, here the IDE works as a front end of GDB, and the IDE communicates GDB with pipes (stdin, stdout, stderror), but strange that the same command “source sim.py” don’t show any Frame window.

If I run the sim.py script line by line under a normal command line GDB, I noticed that after I type the “python frame.Show()” command, a window will pop up, though the window’s content is not updated until I run the command “app.MainLoop()”, which cause the event goes to this window.

But under Code::Blocks’ IDE, after I type the “python frame.Show()”, no window was pop up, the strange thing is:
if I type “python print frame.GetPosition()”, I do get the response “(88, 88)”,
if I type “python print frame.GetSize()”, I do get the response “(400, 250)”,
and both “python print frame.IsShown()” and “python print frame.IsShownOnScreen()” will return “True”.

So, the wxPython system just though the window is shown, but I can’t see the any window, where is the window?

Any hints about this?

Thanks.

BTW: I have checked the “PATH” and “PYTHON_PATH”, and both of the two sessions are the same.
I have also post this question in Code::Blocks’ forum: my post in Code::Blocks forum.

asmwarrior(ollydbg)

Hi, Nathan, thanks for the reply, I just try such code(see below), but the frame is still hidden.

import wx
app = wx.App()
frame = wx.Frame(None, -1, ‘simple.py’)
frame.Show()
wx.Yield()
app.MainLoop()Enter code here…

``

···

On Tuesday, July 29, 2014 10:59:39 AM UTC+8, Nathan McCorkle wrote:

Try calling wx.Yield()

OK, problem solved by using Windows Win32 API function to set the WS_VISIBLE style for the frame. Luckily, wxPython have a GetHandle() function which can let me get the native window handle under Windows. Code are below:

import wx
import ctypes
app = wx.App()
frame = wx.Frame(None, -1, ‘simple.py’)
whnd = frame.GetHandle()

SW_SHOW = 5, so we force to set on the WS_VISIBLE window style, see below as a reference

Window Styles (Windows) - http://msdn.microsoft.com/en-us/library/windows/desktop/ms632600(v=vs.85).aspx

ShowWindow function (Windows) - http://msdn.microsoft.com/en-us/library/windows/desktop/ms633548(v=vs.85).aspx

ctypes.windll.user32.ShowWindow(whnd, 5)
frame.Show()
app.MainLoop()Enter code here…

``