style=wx.SYSTEM_MENU

The following simple test case works, but If I change the style to wx.SYSTEM_MENU it fails miserably, with just the first few letters of the first StaticText displayed. Is there something special that one must do in order to display in a frame that has no decorations such as borders? (I was hoping to work around my VPython problem of not getting menus on the Mac by mocking up my own menus using a wx.SYSTEM_MENU frame.)

import wx

App = wx.App()

w = wx.Frame(None, pos=(0,0), size=(150,100),

style=wx.DEFAULT_FRAME_STYLE)

style=wx.SYSTEM_MENU)

p = wx.Panel(w)

wx.StaticText(p, label=‘Hello world’, pos=(0,0))

wx.StaticText(p, label=‘Hello again’, pos=(0,30))

w.Show()

App.MainLoop()

Hmm. I just discovered that the bug is on Windows but not on Mac. Since I only care about this on the Mac, I guess the failure on Windows doesn’t matter.

There is one other difference between Windows and Mac. The wx.SYSTEM_MENU style on Windows (in addition to not working) has no decorations at all, whereas the Mac version has a title bar along the top (which makes sense if it is to be used for a menu).

Hmm. I just discovered that the bug is on Windows but not on Mac. Since I only care about this on the Mac, I guess the failure on Windows doesn’t matter.

There is one other difference between Windows and Mac. The wx.SYSTEM_MENU style on Windows (in addition to not working) has no decorations at all, whereas the Mac version has a title bar along the top.

Bruce Sherwood wrote:

The following simple test case works, but If I change the style to
wx.SYSTEM_MENU it fails miserably, with just the first few letters of
the first StaticText displayed. Is there something special that one must
do in order to display in a frame that has no decorations such as
borders?

The problem is happening because there was no initial size event and so the panel is still at its small default size, truncating the static text widgets. This can happen for frames with no decorations on Windows that are given a fixed size before any of their child widgets have been added. Try adding w.SendSizeEvent() before calling MainLoop.

···

--
Robin Dunn
Software Craftsman