How does Panel interpret size?

Panel seems to ignore the size parameter. Sample:

4.1.1 msw (phoenix) wxWidgets 3.1.5
Win 10

import wx

app = wx.App()
frame = wx.Frame(None, title="Title")
panel = wx.Panel(frame, size=(500,500))
frame.Show()
app.MainLoop()

The resulting window is the same size regardless of the values given to size.

Provide the size argument to the Frame and things will work as expected.

Explanation:

  • The frame has a size.
  • The panel will fill the frame and therefore will ignore it’s own size.
1 Like

making panels visible…

import wx

app = wx.App()
frame = wx.Frame(None, title="Title")
panel = wx.Panel(frame, size=(60,10))
panel = wx.Panel(frame, size=(30,100))
frame.Show()
app.MainLoop()